Class 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.

    • 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 model
      int getSymbolicValue()
      Get the integer constant used to identify this tree model in some legacy interfaces
      static TreeModel getTreeModel​(int symbolicValue)
      Get the tree model corresponding to a given integer constant
      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.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • TreeModel

        public TreeModel()
    • 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 method Configuration.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
      • 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.
      • 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