Skip to main content

Node

Struct Node 

Source
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

Source

pub fn document(&self) -> &Rc<Document>

The document the node belongs to.

Source

pub fn kind(&self) -> NodeKind

The node kind.

Source

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.

Source

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.

Source

pub fn parent(&self) -> Option<Self>

The parent node.

Source

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

Source

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.

Source

pub fn string_value(&self) -> Cow<'_, str>

The string value (XDM dm:string-value).

Source

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.

Source

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

Source

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.

Source

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

Source

pub fn children(&self) -> Axis ⓘ

The children, in document order.

Source

pub fn attributes(&self) -> Axis ⓘ

The attributes, in document order (the order of the source).

Source

pub fn cmp_document_order(&self, other: &Self) -> Ordering

Document order. Nodes of different documents are ordered by the creation of their documents.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Node

Source§

impl From<Node> for Item

Source§

fn from(node: Node) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Node

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Node

§

impl !Send for Node

§

impl !Sync for Node

§

impl !UnwindSafe for Node

§

impl Forget for Node

§

impl Freeze for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.