public class DocumentWrapper extends GenericTreeInfo
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
Modifier and Type | Field and Description |
---|---|
org.w3c.dom.Node |
docNode |
protected boolean |
domLevel3 |
root
Constructor and Description |
---|
DocumentWrapper(org.w3c.dom.Node doc,
java.lang.String baseURI,
Configuration config)
Wrap a DOM Document or DocumentFragment node
|
Modifier and Type | Method and Description |
---|---|
int |
getDOMLevel()
Get the level of DOM interface to be used
|
java.lang.String[] |
getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given name
|
java.util.Iterator<java.lang.String> |
getUnparsedEntityNames()
Get the list of unparsed entities defined in this document
|
NodeInfo |
selectID(java.lang.String id,
boolean getParent)
Get the element with a given ID, if any
|
void |
setDOMLevel(int level)
Set the level of DOM interface to be used
|
DOMNodeWrapper |
wrap(org.w3c.dom.Node node)
Create a wrapper for a node in this document
|
getConfiguration, getDocumentNumber, getPublicId, getRootNode, getSpaceStrippingRule, getSystemId, getUserData, isStreamed, isTyped, setConfiguration, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
public DocumentWrapper(org.w3c.dom.Node doc, java.lang.String baseURI, Configuration config)
doc
- a DOM Document or DocumentFragment nodebaseURI
- the base URI of the documentconfig
- the Saxon configurationpublic DOMNodeWrapper wrap(org.w3c.dom.Node node)
node
- the DOM node to be wrapped. This must be a node within the document wrapped by this
DocumentWrapperjava.lang.IllegalArgumentException
- if the node is not a descendant of the Document node wrapped by
this DocumentWrapperpublic void setDOMLevel(int level)
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.public int getDOMLevel()
public NodeInfo selectID(java.lang.String id, boolean getParent)
selectID
in interface TreeInfo
selectID
in class GenericTreeInfo
id
- the required ID valuegetParent
- true if the parent of the element having the given ID value is requiredpublic java.util.Iterator<java.lang.String> getUnparsedEntityNames()
getUnparsedEntityNames
in interface TreeInfo
getUnparsedEntityNames
in class GenericTreeInfo
public java.lang.String[] getUnparsedEntity(java.lang.String name)
getUnparsedEntity
in interface TreeInfo
getUnparsedEntity
in class GenericTreeInfo
name
- the name of the entityCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.