Skip to main content

XmlNodeExt

Trait XmlNodeExt 

Source
pub trait XmlNodeExt<'a> {
    // Required methods
    fn tag_name<'s, S: Source + ?Sized>(
        &self,
        source: &'s S,
    ) -> Option<Cow<'s, str>>;
    fn attributes<S: Source + ?Sized>(
        &self,
        source: &S,
    ) -> Vec<(String, String)>;
    fn xml_children(&self) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>;
    fn xml_children_recursive(
        &self,
    ) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>;
    fn text<S: Source + ?Sized>(&self, source: &S) -> String;
    fn read_attr<S: Source + ?Sized>(
        &self,
        source: &S,
        name: &str,
    ) -> Option<String>;
}
Expand description

Extension trait for XML red nodes.

Required Methods§

Source

fn tag_name<'s, S: Source + ?Sized>( &self, source: &'s S, ) -> Option<Cow<'s, str>>

Returns the tag name of the element.

Source

fn attributes<S: Source + ?Sized>(&self, source: &S) -> Vec<(String, String)>

Returns the attributes of the element.

Source

fn xml_children(&self) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>

Returns an iterator over the element’s children that are elements.

Source

fn xml_children_recursive( &self, ) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>

Returns a recursive iterator over all element descendants.

Source

fn text<S: Source + ?Sized>(&self, source: &S) -> String

Returns the text content of the node.

Source

fn read_attr<S: Source + ?Sized>( &self, source: &S, name: &str, ) -> Option<String>

Reads an attribute value by name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> XmlNodeExt<'a> for RedNode<'a, XmlLanguage>

Source§

fn tag_name<'s, S: Source + ?Sized>( &self, source: &'s S, ) -> Option<Cow<'s, str>>

Source§

fn attributes<S: Source + ?Sized>(&self, source: &S) -> Vec<(String, String)>

Source§

fn xml_children(&self) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>

Source§

fn xml_children_recursive( &self, ) -> impl Iterator<Item = RedNode<'a, XmlLanguage>>

Source§

fn text<S: Source + ?Sized>(&self, source: &S) -> String

Source§

fn read_attr<S: Source + ?Sized>( &self, source: &S, name: &str, ) -> Option<String>

Implementors§