Package com.saxonica.ee.domino
Class DominoTree
- java.lang.Object
-
- net.sf.saxon.om.GenericTreeInfo
-
- com.saxonica.ee.domino.DominoTree
-
- All Implemented Interfaces:
javax.xml.transform.Source,TreeInfo,NodeVectorTree
public final class DominoTree extends GenericTreeInfo implements NodeVectorTree
An adaptation of the TinyTree structure, used to index a DOM. The data structure for a DOMINO tree consists of a set of arrays, each containing one entry for every node other than attributes and namespaces. These arrays contain for each node: the node kind, the depth of the node in the tree, an integer fingerprint of the node name, various bit-significant flags, and a reference to the node in the DOM tree being indexed. All navigation is done using the DOMINO index structures, but the DOM nodes are referenced to get the actual data values, and a few other things like prefixes. Attributes are accessed entirely from the DOM structure.- Since:
- 9.8
-
-
Field Summary
Fields Modifier and Type Field Description protected short[]depthprotected org.w3c.dom.Node[]domNodesstatic intHAS_ATTRIBUTESstatic intHAS_CONTINUATIONstatic intHAS_NAMESPACESstatic intHAS_PARENT_POINTERprotected int[]nameCodeprotected int[]nextbyte[]nodeKindprotected intnumberOfNodesprotected int[]prior-
Fields inherited from class net.sf.saxon.om.GenericTreeInfo
root
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AxisIteratorgetAllElements(int fingerprint)Get a list of all elements with a given name.org.w3c.dom.NodegetDomNode(int nodeNr)intgetFingerprint(int nodeNr)Get the fingerprint for a given node, which must be a document, element, text, comment, or processing instruction nodeint[]getNameCodeArray()NamePoolgetNamePool()Get the NamePool used to map element and attribute names to fingerprintsDominoNodegetNode(int nr)Get the node at a given position in the treeintgetNodeKind(int nodeNr)Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction nodebyte[]getNodeKindArray()intgetNumberOfNodes()Get the number of nodes in the tree, excluding attributes and namespace nodesDominoNodegetRootNode()Get the root node of the treeSchemaTypegetSchemaType(int nodeNr)Get the type annotation of a node.java.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 documentbooleanisTyped()Ask whether the tree contains non-trivial type information (from schema validation)static DominoTreemakeTree(org.w3c.dom.Document doc, Configuration config, java.lang.String systemId)Factory method to construct a Domino tree referencing a supplied DOM documentDominoNodeselectID(java.lang.String id, boolean getParent)Get the element with a given ID.voidsetCurrentNode(org.w3c.dom.Node node)-
Methods inherited from class net.sf.saxon.om.GenericTreeInfo
getConfiguration, getDocumentNumber, getPublicId, getSpaceStrippingRule, getSystemId, getUserData, isStreamed, setConfiguration, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
-
-
-
-
Field Detail
-
HAS_PARENT_POINTER
public static final int HAS_PARENT_POINTER
- See Also:
- Constant Field Values
-
HAS_ATTRIBUTES
public static final int HAS_ATTRIBUTES
- See Also:
- Constant Field Values
-
HAS_NAMESPACES
public static final int HAS_NAMESPACES
- See Also:
- Constant Field Values
-
HAS_CONTINUATION
public static final int HAS_CONTINUATION
- See Also:
- Constant Field Values
-
numberOfNodes
protected int numberOfNodes
-
nodeKind
public byte[] nodeKind
-
depth
protected short[] depth
-
next
protected int[] next
-
nameCode
protected int[] nameCode
-
prior
protected int[] prior
-
domNodes
protected org.w3c.dom.Node[] domNodes
-
-
Method Detail
-
makeTree
public static DominoTree makeTree(org.w3c.dom.Document doc, Configuration config, java.lang.String systemId) throws XPathException
Factory method to construct a Domino tree referencing a supplied DOM document- Parameters:
doc- the DOM documentconfig- the Saxon configurationsystemId- the system id (base URI) of the document- Returns:
- the Domino tree object
- Throws:
XPathException- in the event of failure (for example, if there is no Saxon-EE license)
-
isTyped
public boolean isTyped()
Description copied from interface:NodeVectorTreeAsk whether the tree contains non-trivial type information (from schema validation)- Specified by:
isTypedin interfaceNodeVectorTree- Specified by:
isTypedin interfaceTreeInfo- Returns:
- true if type information is present
-
setCurrentNode
public void setCurrentNode(org.w3c.dom.Node node)
-
getDomNode
public org.w3c.dom.Node getDomNode(int nodeNr)
-
getUnparsedEntityNames
public java.util.Iterator<java.lang.String> getUnparsedEntityNames()
Get the list of unparsed entities defined in this document- Specified by:
getUnparsedEntityNamesin interfaceTreeInfo- Overrides:
getUnparsedEntityNamesin classGenericTreeInfo- 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
-
getUnparsedEntity
public java.lang.String[] getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given name- Specified by:
getUnparsedEntityin interfaceTreeInfo- Overrides:
getUnparsedEntityin classGenericTreeInfo- 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.
-
getSchemaType
public SchemaType getSchemaType(int nodeNr)
Get the type annotation of a node. Applies only to document, element, text, processing instruction, and comment nodes.- Parameters:
nodeNr- the node whose type annotation is required- Returns:
- the fingerprint of the type annotation for elements and attributes, otherwise undefined.
-
getNodeKind
public int getNodeKind(int nodeNr)
Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction node- Specified by:
getNodeKindin interfaceNodeVectorTree- Parameters:
nodeNr- the node number- Returns:
- the node kind
-
getFingerprint
public int getFingerprint(int nodeNr)
Get the fingerprint for a given node, which must be a document, element, text, comment, or processing instruction node- Specified by:
getFingerprintin interfaceNodeVectorTree- Parameters:
nodeNr- the node number- Returns:
- the fingerprint, identifying the node name in the name pool
-
getNode
public final DominoNode getNode(int nr)
Get the node at a given position in the tree- Specified by:
getNodein interfaceNodeVectorTree- Parameters:
nr- the node number- Returns:
- the node at the given position
-
getRootNode
public DominoNode getRootNode()
Get the root node of the tree- Specified by:
getRootNodein interfaceTreeInfo- Overrides:
getRootNodein classGenericTreeInfo- Returns:
- the root node
-
selectID
public DominoNode selectID(java.lang.String id, boolean getParent)
Get the element with a given ID.- Specified by:
selectIDin interfaceTreeInfo- Overrides:
selectIDin classGenericTreeInfo- Parameters:
id- The unique ID of the required element, previously registered using registerID()getParent- true if the required element is the parent of the element of type ID- Returns:
- The NodeInfo (always an Element) for the given ID if one has been registered, otherwise null.
-
getNamePool
public NamePool getNamePool()
Get the NamePool used to map element and attribute names to fingerprints- Returns:
- the name pool
-
getNumberOfNodes
public int getNumberOfNodes()
Get the number of nodes in the tree, excluding attributes and namespace nodes- Returns:
- the number of nodes.
-
getAllElements
public AxisIterator getAllElements(int fingerprint)
Get a list of all elements with a given name. This is implemented as a memo function: the first time it is called for a particular element type, it remembers the result for next time.- Parameters:
fingerprint- the fingerprint identifying the required element name- Returns:
- an iterator over all elements with this name
-
getNodeKindArray
public byte[] getNodeKindArray()
- Specified by:
getNodeKindArrayin interfaceNodeVectorTree
-
getNameCodeArray
public int[] getNameCodeArray()
- Specified by:
getNameCodeArrayin interfaceNodeVectorTree
-
-