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[]
depth
protected org.w3c.dom.Node[]
domNodes
static int
HAS_ATTRIBUTES
static int
HAS_CONTINUATION
static int
HAS_NAMESPACES
static int
HAS_PARENT_POINTER
protected int[]
nameCode
protected int[]
next
byte[]
nodeKind
protected int
numberOfNodes
protected 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 AxisIterator
getAllElements(int fingerprint)
Get a list of all elements with a given name.org.w3c.dom.Node
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[]
getNameCodeArray()
NamePool
getNamePool()
Get the NamePool used to map element and attribute names to fingerprintsDominoNode
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[]
getNodeKindArray()
int
getNumberOfNodes()
Get the number of nodes in the tree, excluding attributes and namespace nodesDominoNode
getRootNode()
Get the root node of the treeSchemaType
getSchemaType(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 documentboolean
isTyped()
Ask whether the tree contains non-trivial type information (from schema validation)static DominoTree
makeTree(org.w3c.dom.Document doc, Configuration config, java.lang.String systemId)
Factory method to construct a Domino tree referencing a supplied DOM documentDominoNode
selectID(java.lang.String id, boolean getParent)
Get the element with a given ID.void
setCurrentNode(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: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
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:
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
public java.lang.String[] getUnparsedEntity(java.lang.String name)
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
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:
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
public final DominoNode getNode(int nr)
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
public DominoNode getRootNode()
Get the root node of the tree- Specified by:
getRootNode
in interfaceTreeInfo
- Overrides:
getRootNode
in classGenericTreeInfo
- Returns:
- the root node
-
selectID
public DominoNode selectID(java.lang.String id, boolean getParent)
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
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:
getNodeKindArray
in interfaceNodeVectorTree
-
getNameCodeArray
public int[] getNameCodeArray()
- Specified by:
getNameCodeArray
in interfaceNodeVectorTree
-
-