Class TreeModel

java.lang.Object
net.sf.saxon.om.TreeModel
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DOM4JObjectModel, DOMObjectModel, JDOMObjectModel, XOMObjectModel

public abstract class TreeModel extends Object implements Serializable
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.

See Also:
  • Field Details

    • 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. The main advantage of this model is that it is updateable: the nodes in a LinkedTree can be modified using XQuery Updates.
  • Constructor Details

    • TreeModel

      public TreeModel()
  • Method Details

    • makeBuilder

      public abstract Builder makeBuilder(PipelineConfiguration pipe)
      Make a Builder to construct an instance of this tree model from a stream of events
      Returns:
      a newly created Builder @param pipe
    • 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 - one of the constants Builder.TINY_TREE, Builder.TINY_TREE_CONDENSED, or 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 implement MutableNodeInfo, 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.