[][src]Struct roxmltree::Attribute

pub struct Attribute<'input> { /* fields omitted */ }

An attribute.

Methods

impl<'input> Attribute<'input>[src]

pub fn namespace(&self) -> Option<&str>[src]

Returns attribute's namespace URI.

Examples

let doc = roxmltree::Document::parse(
    "<e xmlns:n='http://www.w3.org' a='b' n:a='c'/>"
).unwrap();

assert_eq!(doc.root_element().attributes()[0].namespace(), None);
assert_eq!(doc.root_element().attributes()[1].namespace(), Some("http://www.w3.org"));

pub fn name(&self) -> &str[src]

Returns attribute's name.

Examples

let doc = roxmltree::Document::parse(
    "<e xmlns:n='http://www.w3.org' a='b' n:a='c'/>"
).unwrap();

assert_eq!(doc.root_element().attributes()[0].name(), "a");
assert_eq!(doc.root_element().attributes()[1].name(), "a");

pub fn value(&self) -> &str[src]

Returns attribute's value.

Examples

let doc = roxmltree::Document::parse(
    "<e xmlns:n='http://www.w3.org' a='b' n:a='c'/>"
).unwrap();

assert_eq!(doc.root_element().attributes()[0].value(), "b");
assert_eq!(doc.root_element().attributes()[1].value(), "c");

pub fn range(&self) -> Range<usize>[src]

Returns attribute's name range in bytes in the original document.

You can calculate a human-readable text position via Document::text_pos_at.

<e attr='value'/>
   ^

pub fn value_range(&self) -> Range<usize>[src]

Returns attribute's value range in bytes in the original document.

You can calculate a human-readable text position via Document::text_pos_at.

<e attr='value'/>
         ^

Trait Implementations

impl<'input> Clone for Attribute<'input>[src]

impl<'input> Debug for Attribute<'input>[src]

impl<'input> PartialEq<Attribute<'input>> for Attribute<'input>[src]

Auto Trait Implementations

impl<'input> !RefUnwindSafe for Attribute<'input>

impl<'input> !Send for Attribute<'input>

impl<'input> !Sync for Attribute<'input>

impl<'input> Unpin for Attribute<'input>

impl<'input> UnwindSafe for Attribute<'input>

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<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.