public abstract class SaplingNode
extends java.lang.Object
NodeInfo
or XdmNode for further processing, or it can be sent to a destination such as a Serializer
or SchemaValidator.
The SaplingDocument node at the root of a constructed tree implements the JAXP Source interface
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:
xml:base attributes; only document nodes have their own base URIAttributes 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.
| Constructor and Description |
|---|
SaplingNode() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
getNodeKind()
Get the kind of node (document, element, text, comment, or processing instruction)
|
protected abstract void |
sendTo(Receiver receiver)
Send a sequence of events representing this node to a supplied Receiver
|
public abstract int getNodeKind()
Type.ELEMENT for an element node.protected abstract void sendTo(Receiver receiver) throws XPathException
receiver - the receiver to which the events are to be sentXPathException - if the receiver throws an exceptionCopyright (c) 2004-2021 Saxonica Limited. All rights reserved.