Package net.sf.saxon.om
Class TreeModel
- java.lang.Object
-
- net.sf.saxon.om.TreeModel
-
- Direct Known Subclasses:
AxiomObjectModel
,DOM4JObjectModel
,DominoTreeModel
,DOMObjectModel
,JDOM2ObjectModel
,XOMObjectModel
public abstract class TreeModel extends java.lang.Object
A TreeModel represents an implementation of the Saxon NodeInfo interface, which itself is essentially an implementation of the XDM model defined in W3C specifications (except that Saxon's NodeInfo understands the 13 XPath axes, rather than merely supporting parent and child properties).This class serves two purposes: it acts as a factory for obtaining a Builder which can be used to build trees using this tree model; and it provides static constants that can be used to identify the built-in tree models.
-
-
Field Summary
Fields Modifier and Type Field Description static TreeModel
LINKED_TREE
The LinkedTree.static TreeModel
TINY_TREE
The TinyTree implementation.static TreeModel
TINY_TREE_CONDENSED
The CondensedTinyTree implementation.
-
Constructor Summary
Constructors Constructor Description TreeModel()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Get a name that identifies the tree modelint
getSymbolicValue()
Get the integer constant used to identify this tree model in some legacy interfacesstatic TreeModel
getTreeModel(int symbolicValue)
Get the tree model corresponding to a given integer constantboolean
isMutable()
Ask whether this tree model supports updating (that is, whether the nodes in the constructed tree will implementMutableNodeInfo
, which is necessary if they are to support XQuery Update.boolean
isSchemaAware()
Ask whether this tree model supports the use of type annotations on element and attribute nodes.abstract Builder
makeBuilder(PipelineConfiguration pipe)
Make a Builder, which can then be used to construct an instance of this tree model from a stream of events
-
-
-
Field Detail
-
TINY_TREE
public static final TreeModel TINY_TREE
The TinyTree implementation. This is normally the default implementation of the tree model.
-
TINY_TREE_CONDENSED
public static final TreeModel TINY_TREE_CONDENSED
The CondensedTinyTree implementation. This is a variant of the TinyTree that uses less memory but takes a little longer to build. Run-time performance is the same as the TinyTree.
-
LINKED_TREE
public static final TreeModel LINKED_TREE
The LinkedTree. This takes more memory than the TinyTree, but offers flexibility for storing user-defined data in each element node; it is also mutable, supporting XQuery Update
-
-
Method Detail
-
makeBuilder
public abstract Builder makeBuilder(PipelineConfiguration pipe)
Make a Builder, which can then be used to construct an instance of this tree model from a stream of events- Parameters:
pipe
- A PipelineConfiguration, which can be constructed using the methodConfiguration.makePipelineConfiguration()
.- Returns:
- a newly created Builder
-
getSymbolicValue
public int getSymbolicValue()
Get the integer constant used to identify this tree model in some legacy interfaces- Returns:
- an integer constant used to identify the model, for example
Builder.TINY_TREE
-
getTreeModel
public static TreeModel getTreeModel(int symbolicValue)
Get the tree model corresponding to a given integer constant- Parameters:
symbolicValue
- typically one of the constantsBuilder.TINY_TREE
,Builder.TINY_TREE_CONDENSED
,Builder.LINKED_TREE
.- Returns:
- the corresponding TreeModel
-
isMutable
public boolean isMutable()
Ask whether this tree model supports updating (that is, whether the nodes in the constructed tree will implementMutableNodeInfo
, which is necessary if they are to support XQuery Update. This method can be overridden in subclasses; the default implementation returns false.- Returns:
- true if the tree model implementation supports updating, that is, if its nodes support the MutableNodeInfo interface.
-
isSchemaAware
public boolean isSchemaAware()
Ask whether this tree model supports the use of type annotations on element and attribute nodes. If false, all nodes in this tree are untyped (for elements) or untypedAtomic (for attributes). The default implementation returns false.- Returns:
- true if type annotations other than xs:untyped and xs:untypedAtomic are supported.
-
getName
public java.lang.String getName()
Get a name that identifies the tree model- Returns:
- an identifying name for the tree model
-
-