[][src]Struct trashy_xml::XmlParser

pub struct XmlParser {
    pub xml_tokens: Vec<XmlToken>,
    pub errors: Vec<XmlError>,
    // some fields omitted
}

Examples

use trashy_xml::{XmlKind, XmlMethods, XmlParser};

let mut parser = XmlParser::new("sample_files/small.xml").unwrap();
parser.parse();
for token in &parser.xml_tokens {
    if let XmlKind::OpenElement(name, _) = &token.kind {
        if name == "element" {
            for attribute in parser.xml_tokens.get_attributes(token) {
                dbg!(&attribute);
            }
        }
    }
}

Fields

xml_tokens: Vec<XmlToken>errors: Vec<XmlError>

Methods

impl XmlParser[src]

pub fn new<P: AsRef<Path>>(filepath: P) -> Option<XmlParser>[src]

Constructs a new XmlParser.

pub fn parse(&mut self) -> Option<&Self>[src]

Trait Implementations

impl Debug for XmlParser[src]

impl FromStr for XmlParser[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Iterator for XmlParser[src]

type Item = Token

The type of the elements being iterated over.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.