- Direct Known Subclasses:
public abstract class SaplingNode extends java.lang.ObjectThis class represents a sapling node. Sapling nodes represent transient nodes used in the course of tree construction; they are intended to have a very lightweight implementation, making construction as simple as possible, and they do not support any complex navigation or query interfaces. Typically when construction of a sapling tree is complete it will be converted to a regular
XdmNodefor further processing, or it can be sent to a destination such as a
SaplingDocumentnode at the root of a constructed tree implements the JAXP
Sourceinterface which is widely accepted by a variety of interfaces in Saxon: this means that it can readily be used as input to a query, a transformation, a document builder, or a schema validator.
Sapling nodes are immutable objects; operations such as
SaplingElement.withChild(net.sf.saxon.sapling.SaplingNode...)create a new object and leave the original unchanged. This eliminates the need (found in other models such as the DOM) to make copies of nodes when attaching them to a tree.
The data model supported by Sapling nodes is close to the XDM model, but with some limitations:
- All nodes are untyped (elements are of type xs:untyped, attributes are xs:untypedAtomic).
- The ID, IDREF, and NILLED properties cannot be set.
- Some constraints on the model (for example, rules on the lexical form of names) are not enforced by the construction API.
- Elements cannot have an independent base URI property, except to the extent that this can be
xml:baseattributes; only document nodes have their own base URI
- Zero length text nodes and adjacent text node siblings are permitted (they will be merged or eliminated when the sapling tree is converted to a regular node tree)
Attributes are not represented as nodes in their own right, but rather as properties of element nodes.
The internal representation of document and element nodes include a list of the node's children; but there are no links back from a node to its parent. This enables a node to be attached as a child to many different parents. This does not create problems, because nodes are immutable, and there are no operations that depend on concepts of node identity or document order.
As in XDM, an element node contains a set of in-scope namespaces. There is no requirement that the in-scope namespaces of an element should be in any way related to those of its child or parent elements. Operations that construct a regular tree from a sapling tree will introduce namespace inheritance, whereby namespaces defined on a parent element are inherited by its children. Namespace bindings for the (prefix, URI) pairs used in the names of elements and attributes are added to an element automatically; additional namespace bindings may be added by explicit API request.
Constructors Constructor Description
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
deliver(Receiver receiver, ParseOptions options)Send a sequence of events representing this node to a supplied Receiver
getNodeKind()Get the kind of node (document, element, text, comment, or processing instruction)
protected ImmutableList<SaplingNode> emptyNodeList()
public abstract int getNodeKind()Get the kind of node (document, element, text, comment, or processing instruction)
- the kind of node, for example
Type.ELEMENTfor an element node.
public abstract void deliver(Receiver receiver, ParseOptions options) throws XPathExceptionSend a sequence of events representing this node to a supplied Receiver
receiver- the receiver to which the events are to be sent
options- parse options (currently ignored)
XPathException- if the receiver throws an exception