Struct xml::ElementBuilder [] [src]

pub struct ElementBuilder {
    // some fields omitted

An Element Builder, building Elements from Events as produced by Parser

use xml::{Parser, ElementBuilder};

let mut parser = Parser::new();
let mut builder = ElementBuilder::new();

for result in parser.filter_map(|event| builder.handle_event(event)) {
    println!("{}", result.unwrap());


impl ElementBuilder

fn new() -> ElementBuilder

Returns a new ElementBuilder

fn define_prefix(&mut self, prefix: String, ns: String)

Bind a prefix to a namespace

fn set_default_ns(&mut self, ns: String)

Set the default namespace

fn handle_event(&mut self, e: Result<Event, ParserError>) -> Option<Result<Element, BuilderError>>

Let the builder process an Event to ultimately build an Element.

While no root element has been finished None is returned. Once sufficent data has been received an Element is returned as Some(Ok(elem)). Upon Error Some(Err("message")) is returned.