Package com.saxonica.ee.domino
Class DominoTree
java.lang.Object
net.sf.saxon.om.GenericTreeInfo
com.saxonica.ee.domino.DominoTree
- All Implemented Interfaces:
Source
,TreeInfo
,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
FieldsModifier and TypeFieldDescriptionprotected short[]
protected Node[]
static final int
static final int
static final int
static final int
protected int[]
protected int[]
byte[]
protected int
protected int[]
Fields inherited from class net.sf.saxon.om.GenericTreeInfo
root
-
Method Summary
Modifier and TypeMethodDescriptiongetAllElements
(int fingerprint) Get a list of all elements with a given name.getDomNode
(int nodeNr) int
getFingerprint
(int nodeNr) Get the fingerprint for a given node, which must be a document, element, text, comment, or processing instruction nodeint[]
Get the NamePool used to map element and attribute names to fingerprintsfinal DominoNode
getNode
(int nr) Get the node at a given position in the treeint
getNodeKind
(int nodeNr) Get the node kind of a given node, which must be a document, element, text, comment, or processing instruction nodebyte[]
int
Get the number of nodes in the tree, excluding attributes and namespace nodesGet the root node of the treegetSchemaType
(int nodeNr) Get the type annotation of a node.String[]
getUnparsedEntity
(String name) Get the unparsed entity with a given nameGet the list of unparsed entities defined in this documentboolean
isTyped()
Ask whether the tree contains non-trivial type information (from schema validation)static DominoTree
makeTree
(Document doc, Configuration config, String systemId) Factory method to construct a Domino tree referencing a supplied DOM documentGet the element with a given ID.void
setCurrentNode
(Node node) Methods inherited from class net.sf.saxon.om.GenericTreeInfo
getConfiguration, getDocumentNumber, getDurability, getPublicId, getSpaceStrippingRule, getSystemId, getUserData, isMutable, isStreamed, setConfiguration, setDocumentNumber, setDurability, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
-
Field Details
-
HAS_PARENT_POINTER
public static final int HAS_PARENT_POINTER- See Also:
-
HAS_ATTRIBUTES
public static final int HAS_ATTRIBUTES- See Also:
-
HAS_NAMESPACES
public static final int HAS_NAMESPACES- See Also:
-
HAS_CONTINUATION
public static final int HAS_CONTINUATION- See Also:
-
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
-
-
Method Details
-
makeTree
public static DominoTree makeTree(Document doc, Configuration config, 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:NodeVectorTree
Ask whether the tree contains non-trivial type information (from schema validation)- Specified by:
isTyped
in interfaceNodeVectorTree
- Specified by:
isTyped
in interfaceTreeInfo
- Returns:
- true if type information is present
-
setCurrentNode
-
getDomNode
-
getUnparsedEntityNames
Get the list of unparsed entities defined in this document- Specified by:
getUnparsedEntityNames
in interfaceTreeInfo
- Overrides:
getUnparsedEntityNames
in 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
Get the unparsed entity with a given name- Specified by:
getUnparsedEntity
in interfaceTreeInfo
- Overrides:
getUnparsedEntity
in 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
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:
getNodeKind
in 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:
getFingerprint
in interfaceNodeVectorTree
- Parameters:
nodeNr
- the node number- Returns:
- the fingerprint, identifying the node name in the name pool
-
getNode
Get the node at a given position in the tree- Specified by:
getNode
in interfaceNodeVectorTree
- Parameters:
nr
- the node number- Returns:
- the node at the given position
-
getRootNode
Get the root node of the tree- Specified by:
getRootNode
in interfaceTreeInfo
- Overrides:
getRootNode
in classGenericTreeInfo
- Returns:
- the root node
-
selectID
Get the element with a given ID.- Specified by:
selectID
in interfaceTreeInfo
- Overrides:
selectID
in 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
Get the NamePool used to map element and attribute names to fingerprints- Specified by:
getNamePool
in interfaceNodeVectorTree
- 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
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:
getNodeKindArray
in interfaceNodeVectorTree
-
getNameCodeArray
public int[] getNameCodeArray()- Specified by:
getNameCodeArray
in interfaceNodeVectorTree
-