pub struct Node { /* private fields */ }Expand description
A node: a document and the position of the node in it.
Two Node values are equal when they are the same node (XPath is).
Implementations§
Source§impl Node
impl Node
Sourcepub fn name(&self) -> Option<&QName>
pub fn name(&self) -> Option<&QName>
The name of an element or attribute, with the prefix it was written with, or the
target of a processing instruction (as a local name); None for other nodes.
Sourcepub fn name_id(&self) -> Option<u32>
pub fn name_id(&self) -> Option<u32>
The number of the node’s name in its document, None for a node without name:
two nodes of a document have the same number when their names have the same
prefix, local name and namespace. Numbers are below Document::name_count.
Sourcepub fn root(&self) -> Self
pub fn root(&self) -> Self
The root of the tree: the document node, or the parentless node of a tree built
without one (TreeBuilder::parentless).
Sourcepub fn namespaces_in_scope(&self) -> Vec<NamespaceBinding>
pub fn namespaces_in_scope(&self) -> Vec<NamespaceBinding>
The namespace nodes of an element (XDM dm:namespace-nodes, the implicit xml
namespace excepted): those it was given, or declared in the text it was parsed
from, and those of its ancestors, the nearest binding of a prefix winning,
innermost element first; a binding to the empty URI (xmlns="") takes the default
namespace away. Empty for other nodes.
Sourcepub fn string_value(&self) -> Cow<'_, str>
pub fn string_value(&self) -> Cow<'_, str>
The string value (XDM dm:string-value).
Sourcepub fn by_id(&self, id: &str) -> Option<Self>
pub fn by_id(&self, id: &str) -> Option<Self>
The element of the node’s tree with the ID id: for a TreeView::Tiny tree,
the first element in document order with an xml:id attribute of that value
(whitespace-collapsed), as Saxon-HE 12.10 finds it; never for a
TreeView::Dom tree.
Sourcepub fn generate_id(&self) -> String
pub fn generate_id(&self) -> String
generate-id() as Saxon-HE 12.10 forms it for the kind of tree
(TreeView); the document number is the creation order of the document, which
in Saxon depends on what the JVM read before (so are its IDs: only their form is
Saxon’s). An attribute of a TreeView::Tiny tree gets its element’s ID, a and
its number among the attributes of the tree (Saxon’s, the fingerprint of its name
in Saxon’s name pool, depends on the JVM too).
Sourcepub fn typed_value(&self) -> AtomicValue
pub fn typed_value(&self) -> AtomicValue
The typed value of the node in an untyped tree: xs:untypedAtomic, except for
comments and processing instructions, whose typed value is an xs:string.
Sourcepub fn axis(&self, axis: NodeAxis) -> Axis ⓘ
pub fn axis(&self, axis: NodeAxis) -> Axis ⓘ
The nodes on an axis from this node, in axis order (reverse document order for the reverse axes).
Sourcepub fn attributes(&self) -> Axis ⓘ
pub fn attributes(&self) -> Axis ⓘ
The attributes, in document order (the order of the source).
Sourcepub fn cmp_document_order(&self, other: &Self) -> Ordering
pub fn cmp_document_order(&self, other: &Self) -> Ordering
Document order. Nodes of different documents are ordered by the creation of their documents.