pub enum Item {
Atomic(Atomic),
Node(Node),
Function(Function),
}
Expand description
An XPath item. These are the items that make up an XPath sequence.
Variants§
Atomic(Atomic)
An atomic value.
One of the value types defined by XPath, indicated by an xs:*
type
such as xs:integer
or xs:string
.
Node(Node)
A node in an XML document.
This is defined using the xot
library.
Function(Function)
An XPath function type.
Implementations§
Source§impl Item
impl Item
Sourcepub fn to_function(&self) -> Result<Function, Error>
pub fn to_function(&self) -> Result<Function, Error>
Try to get the function value of the item.
Sourcepub fn effective_boolean_value(&self) -> Result<bool, Error>
pub fn effective_boolean_value(&self) -> Result<bool, Error>
Obtain the effective boolean value of the item.
-
If the item is a node, it’s true.
-
If the item is a boolean, it’s the value of the boolean.
-
If the item is a string, it’s false if it’s empty, otherwise true.
-
If the item is a numeric type, it’s false if it’s NaN or zero, otherwise true.
-
Functions are always errors.
Sourcepub fn try_into_value<V>(&self) -> Result<V, Error>
pub fn try_into_value<V>(&self) -> Result<V, Error>
Convert an atomic value into a value of type V
.
Sourcepub fn string_value(&self, xot: &Xot) -> Result<String, Error>
pub fn string_value(&self, xot: &Xot) -> Result<String, Error>
Construct the string value.
-
For an atomic value, it casts it to a string using the canonical lexical representation rules as defined by XML Schema.
-
For a node, it returns the string value of the node.
-
For a function, it errors.
Sourcepub fn display_representation(
&self,
xot: &Xot,
context: &DynamicContext<'_>,
) -> Result<String, Error>
pub fn display_representation( &self, xot: &Xot, context: &DynamicContext<'_>, ) -> Result<String, Error>
Display representation of an item For atomics this is a true parseable XPath representation. For node and function that does not exist, so we generate a plausible version for display purposes only.
Trait Implementations§
Source§impl<'a> FromIterator<&'a Item> for Sequence
impl<'a> FromIterator<&'a Item> for Sequence
Source§impl FromIterator<Item> for Sequence
impl FromIterator<Item> for Sequence
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl !Send for Item
impl !Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more