pub enum Item<N: Node> {
Node(N),
Function,
Value(Value),
}
Expand description
Variants§
Node(N)
A Node in the source document.
Function
Functions are not yet supported
Value(Value)
A scalar value
Implementations§
source§impl<N: Node> Item<N>
impl<N: Node> Item<N>
sourcepub fn to_xml_with_options(&self, od: &OutputDefinition) -> String
pub fn to_xml_with_options(&self, od: &OutputDefinition) -> String
Serialize as XML, with options
sourcepub fn to_bool(&self) -> bool
pub fn to_bool(&self) -> bool
Determine the effective boolean value of the item. See XPath 2.4.3.
sourcepub fn to_double(&self) -> f64
pub fn to_double(&self) -> f64
Gives the double value of the item. Returns NaN if the value cannot be converted to a double.
sourcepub fn name(&self) -> QualifiedName
pub fn name(&self) -> QualifiedName
Gives the name of the item. Certain types of Nodes have names, such as element-type nodes. If the item does not have a name returns an empty string.
sourcepub fn is_element_node(&self) -> bool
pub fn is_element_node(&self) -> bool
Is this item an element-type node?
sourcepub fn add_attribute(&self, a: N) -> Result<(), Error>
pub fn add_attribute(&self, a: N) -> Result<(), Error>
Convenience method to set an attribute for a Node-type item. If the item is not an element-type node, then this method has no effect.
sourcepub fn shallow_copy(&self) -> Result<Self, Error>
pub fn shallow_copy(&self) -> Result<Self, Error>
Make a shallow copy of an item. That is, the item is duplicated but not it’s content, including attributes.
Trait Implementations§
Auto Trait Implementations§
impl<N> RefUnwindSafe for Item<N>where
N: RefUnwindSafe,
impl<N> Send for Item<N>where
N: Send,
impl<N> Sync for Item<N>where
N: Sync,
impl<N> Unpin for Item<N>where
N: Unpin,
impl<N> UnwindSafe for Item<N>where
N: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more