Package net.sf.saxon.dom
Class DocumentWrapper
- java.lang.Object
- 
- net.sf.saxon.om.GenericTreeInfo
- 
- net.sf.saxon.dom.DocumentWrapper
 
 
- 
- All Implemented Interfaces:
- javax.xml.transform.Source,- TreeInfo
 
 public class DocumentWrapper extends GenericTreeInfo The tree info object for a tree implemented as a wrapper around a DOM Document.Because the DOM is not thread-safe even when reading, and because Saxon-EE can spawn multiple threads that access the same input tree, all methods that invoke DOM methods are synchronized on the Document node 
- 
- 
Field SummaryFields Modifier and Type Field Description org.w3c.dom.NodedocNodeprotected booleandomLevel3- 
Fields inherited from class net.sf.saxon.om.GenericTreeInforoot
 
- 
 - 
Constructor SummaryConstructors Constructor Description DocumentWrapper(org.w3c.dom.Node doc, java.lang.String baseURI, Configuration config)Wrap a DOM Document or DocumentFragment node
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDOMLevel()Get the level of DOM interface to be usedjava.lang.String[]getUnparsedEntity(java.lang.String name)Get the unparsed entity with a given namejava.util.Iterator<java.lang.String>getUnparsedEntityNames()Get the list of unparsed entities defined in this documentNodeInfoselectID(java.lang.String id, boolean getParent)Get the element with a given ID, if anyvoidsetDOMLevel(int level)Set the level of DOM interface to be usedDOMNodeWrapperwrap(org.w3c.dom.Node node)Create a wrapper for a node in this document- 
Methods inherited from class net.sf.saxon.om.GenericTreeInfogetConfiguration, getDocumentNumber, getPublicId, getRootNode, getSpaceStrippingRule, getSystemId, getUserData, isStreamed, setConfiguration, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
 
- 
 
- 
- 
- 
Constructor Detail- 
DocumentWrapperpublic DocumentWrapper(org.w3c.dom.Node doc, java.lang.String baseURI, Configuration config)Wrap a DOM Document or DocumentFragment node- Parameters:
- doc- a DOM Document or DocumentFragment node
- baseURI- the base URI of the document
- config- the Saxon configuration
 
 
- 
 - 
Method Detail- 
wrappublic DOMNodeWrapper wrap(org.w3c.dom.Node node) Create a wrapper for a node in this document- Parameters:
- node- the DOM node to be wrapped. This must be a node within the document wrapped by this DocumentWrapper
- Returns:
- the wrapped node
- Throws:
- java.lang.IllegalArgumentException- if the node is not a descendant of the Document node wrapped by this DocumentWrapper
 
 - 
setDOMLevelpublic void setDOMLevel(int level) Set the level of DOM interface to be used- Parameters:
- level- the DOM level. Must be 2 or 3. By default Saxon assumes that DOM level 3 is available; this parameter can be set to the value 2 to indicate that Saxon should not use methods unless they are available in DOM level 2. From Saxon 9.2, this switch remains available, but the use of DOM level 2 is untested and unsupported.
 
 - 
getDOMLevelpublic int getDOMLevel() Get the level of DOM interface to be used- Returns:
- the DOM level. Always 2 or 3.
 
 - 
selectIDpublic NodeInfo selectID(java.lang.String id, boolean getParent) Get the element with a given ID, if any- Specified by:
- selectIDin interface- TreeInfo
- Overrides:
- selectIDin class- GenericTreeInfo
- Parameters:
- id- the required ID value
- getParent- true if the parent of the element having the given ID value is required
- Returns:
- a NodeInfo representing the element with the given ID, or null if there is no such element. This implementation does not necessarily conform to the rule that if an invalid document contains two elements with the same ID, the one that comes last should be returned.
 
 - 
getUnparsedEntityNamespublic java.util.Iterator<java.lang.String> getUnparsedEntityNames() Get the list of unparsed entities defined in this document- Specified by:
- getUnparsedEntityNamesin interface- TreeInfo
- Overrides:
- getUnparsedEntityNamesin class- GenericTreeInfo
- Returns:
- an Iterator, whose items are of type String, containing the names of all unparsed entities defined in this document. If there are no unparsed entities or if the information is not available then an empty iterator is returned
- Since:
- 9.1 (implemented for this subclass since 9.2)
 
 - 
getUnparsedEntitypublic java.lang.String[] getUnparsedEntity(java.lang.String name) Get the unparsed entity with a given name- Specified by:
- getUnparsedEntityin interface- TreeInfo
- Overrides:
- getUnparsedEntityin class- GenericTreeInfo
- Parameters:
- name- the name of the entity
- Returns:
- if the entity exists, return an array of two Strings, the first holding the system ID of the entity (as an absolute URI if possible), the second holding the public ID if there is one, or null if not. If the entity does not exist, the method returns null. Applications should be written on the assumption that this array may be extended in the future to provide additional information.
- Since:
- 8.4 (implemented for this subclass since 9.2)
 
 
- 
 
-