Struct vtd_xml::VtdNav
[−]
[src]
pub struct VtdNav { pub vtd_nav: *mut VTDNav, pub to_vtd: Vec<UCSChar>, pub from_vtd: String, // some fields omitted }
A cursor into the parsed XML document.
Fields
to_vtd: Vec<UCSChar>
from_vtd: String
Methods
impl VtdNav
[src]
fn new(vg: &mut VtdGen) -> VtdNav
Gets the document from the VtdGen
, leaving the latter empty and ready to parse another one.
fn raw<'a>(&'a mut self) -> &'a String
Retrieve a string under the cursor.
The string is cooked raw, meaning that "built-in entity and char references not resolved; entities and char references not expanded".
fn to_named_element<'t>(&mut self,
direction: Direction,
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
direction: Direction,
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
Navigate the cursor to the first element in the given direction that matches the tag
name.
fn up(&mut self) -> Result<&mut VtdNav, VtdNavError>
Navigate the cursor up.
fn first_child<'t>(&mut self,
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
Navigate the cursor to the first child that matches the tag
name.
fn next_sibling<'t>(&mut self,
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
tag: &'t str)
-> Result<&mut VtdNav, VtdNavError<'t>>
Navigate the cursor to the next sibling that matches the tag
name.
fn child_iter(&mut self, tag: &str) -> VtdChildIter
Iterator over the children nodes having the given tag
name.
NB: Creating an iterator is a rather costly operation, TBH.
We have to allocate a new VTDNav
in order for the iterator not to hold a &mut
reference to the original VtdNav
cursor.
On the other hand, while using the iterator we don't have to recode the tag
on every cycle.
fn raw_attr<'a>(&'a mut self, attr: &str) -> Option<&'a mut String>
Contents of the given attribute value.
Returned string is cooked raw, meaning that "built-in entity and char references not resolved; entities and char references not expanded".
attr
- The name of the attribute to retrieve.
fn text<'a>(&'a mut self) -> Option<&'a mut String>
The chunk of text from inside the current tag.
fn idx(&self) -> VtdNavPosition
The current cursor position.
fn set_idx(&mut self, idx: VtdNavPosition) -> &mut VtdNav
Move the cursor to the given position.
Trait Implementations
impl Display for VtdNav
[src]
Invokes toString
on the cursor.