Class DocumentBuilder
Class DomDestination
Class DynamicContext
Class DynamicError
Class EmptyEnumerator
Class ExtensionFunctionCall
Class NullDestination
Class Processor
Class QName
Class SchemaManager
Class SchemaValidator
Class Serializer
Class StaticContext
Class StaticError
Class TextWriterDestination
Class XPathCompiler
Class XPathExecutable
Class XPathSelector
Class XQueryCompiler
Class XQueryEvaluator
Class XQueryExecutable
Class XdmAnyFunctionType
Class XdmAnyItemType
Class XdmAnyNodeType
Class XdmAtomicType
Class XdmAtomicValue
Class XdmDestination
Class XdmEmptySequence
Class XdmItem
Class XdmItemType
Class XdmNode
Class XdmNodeKind
Class XdmSequenceType
Class XdmValue
Class XmlDestination
Class XsltCompiler
Class XsltExecutable
Class XsltTransformer
Enum RecoveryPolicy
Enum SchemaValidationMode
Enum TreeModel
Enum WhitespacePolicy
Enum XdmAxis
Interface IMessageListener
Interface IQueryResolver
Interface IResultDocumentHandler
Interface IXdmEnumerator
Interface IXmlLocation
Interface SchemaResolver
public class XdmNode
The class XdmNode
represents a Node in the XDM Data Model. A Node
is an XdmItem
, and is therefore an XdmValue
in its own right, and may also participate
as one item within a sequence value.
An XdmNode
is implemented as a wrapper around an object
of type net.sf.saxon.NodeInfo
. Because this is a key interface
within Saxon, it is exposed via this API, even though it is a Java
interface that is not part of the API proper.
The XdmNode
interface exposes basic properties of the node, such
as its name, its string value, and its typed value. Navigation to other nodes
is supported through a single method, EnumerateAxis
, which allows
other nodes to be retrieved by following any of the XPath axes.
Property Summary | |
---|---|
QName |
NodeName
The name of the node, as a |
XmlNodeType |
NodeKind
The kind of node, as an instance of |
XdmValue |
TypedValue
The typed value of the node, as an instance of |
String |
StringValue The string value of the node. |
XdmNode |
Parent Get the parent of this node. |
XdmNode |
Root Get the root of the tree containing this node. |
Uri |
BaseUri The Base URI of the node. |
Uri |
DocumentUri The Document URI of the node. |
String |
OuterXml Return a serialization of this node as lexical XML |
NodeInfo |
Implementation Escape hatch to the underlying class in the Java implementation |
Method Summary | |
---|---|
bool |
IsAtomic() Determine whether the item is an atomic value |
String |
GetAttributeValue(QName name) Get a the string value of a named attribute of this element. |
IEnumerator |
EnumerateAxis(XdmAxis axis) Get an enumerator that supplies all the nodes on one of the XPath axes, starting with this node. |
IEnumerator |
EnumerateAxis(XdmAxis axis, QName nodeName) Get an enumerator that selects all the nodes on one of the XPath axes, provided they have a given name. The nodes selected are those of the principal node kind (elements for most axes, attributes for the attribute axis, namespace nodes for the namespace axis) whose name matches the name given in the second argument. |
void |
WriteTo(System.Xml.XmlWriter writer)
Send the node (that is, the subtree rooted at this node) to an |
String |
ToString() Return a string representation of the node. |
Property Detail |
---|
public QName NodeName {get; }
The name of the node, as a QName
. Returns null in the case of unnamed nodes.
public XmlNodeType NodeKind {get; }
The kind of node, as an instance of System.Xml.XmlNodeType
.
For a namespace node in the XDM model, the value XmlNodeType.None is returned.
public XdmValue TypedValue {get; }
The typed value of the node, as an instance of XdmValue
.
public String StringValue {get; }
The string value of the node.
public XdmNode Parent {get; }
Get the parent of this node.
Returns either a document node, and element node, or null in the case where this node has no parent.
public XdmNode Root {get; }
Get the root of the tree containing this node.
Returns the root of the tree containing this node (which might be this node itself).
public Uri BaseUri {get; }
The Base URI of the node.
public Uri DocumentUri {get; }
The Document URI of the node.
public String OuterXml {get; }
Return a serialization of this node as lexical XML
In the case of an element node, the result will be a well-formed XML document serialized as defined in the W3C XSLT/XQuery serialization specification, using options method="xml", indent="yes", omit-xml-declaration="yes".
In the case of a document node, the result will be a well-formed XML document provided that the document node contains exactly one element child, and no text node children. In other cases it will be a well-formed external general parsed entity.
In the case of an attribute node, the output is a string in the form
name="value"
. The name will use the original namespace prefix.
Other nodes, such as text nodes, comments, and processing instructions, are represented as they would appear in lexical XML.
public NodeInfo Implementation {get; }
Escape hatch to the underlying class in the Java implementation
Method Detail |
---|
public bool IsAtomic()
Determine whether the item is an atomic value
public String GetAttributeValue(QName name)
Get a the string value of a named attribute of this element.
Returns null if this node is not an element, or if this element has no attribute with the specified name.
Parameters:name
-
public IEnumerator EnumerateAxis(XdmAxis axis)
Get an enumerator that supplies all the nodes on one of the XPath axes, starting with this node.
The nodes are returned in axis order: that is, document order for a forwards axis, reverse document order for a reverse axis.
Parameters:axis
-
XdmAxis.Child
for the child axis.
public IEnumerator EnumerateAxis(XdmAxis axis, QName nodeName)
Get an enumerator that selects all the nodes on one of the XPath axes, provided they have a given name. The nodes selected are those of the principal node kind (elements for most axes, attributes for the attribute axis, namespace nodes for the namespace axis) whose name matches the name given in the second argument.
The nodes are returned in axis order: that is, document order for a forwards axis, reverse document order for a reverse axis.
Parameters:axis
-
XdmAxis.Child
for the child axis.
nodeName
-
new QName("", "item")
to select
nodes with local name "item", in no namespace.
public void WriteTo(System.Xml.XmlWriter writer)
Send the node (that is, the subtree rooted at this node) to an XmlWriter
Note that a XmlWriter
can only handle a well-formed XML document. This method
will therefore signal an exception if the node is a document node with no children, or with
more than one element child.
writer
-
XmlWriter
to which the node is to be written
public String ToString()
Return a string representation of the node.
This currently returns the same as the OuterXml
property.
To get the string value as defined in XPath, use the StringValue
property.