Struct xml_writer::XmlWriter
[−]
[src]
pub struct XmlWriter<'a, W: Write> { pub pretty: bool, pub namespace: Option<&'a str>, // some fields omitted }
The XmlWriter himself
Fields
pretty: bool
if true
it will indent all opening elements
namespace: Option<&'a str>
an XML namespace that all elements will be part of, unless None
Methods
impl<'a, W: Write> XmlWriter<'a, W>
[src]
fn new(writer: W) -> XmlWriter<'a, W>
[src]
Create a new writer, by passing an io::Write
fn dtd(&mut self, encoding: &str) -> Result<()>
[src]
Write the DTD
fn ns_decl(&mut self, ns_map: &Vec<(Option<&'a str>, &'a str)>) -> Result<()>
[src]
Writes namespace declarations (xmlns:xx) into the currently open element
fn elem(&mut self, name: &str) -> Result<()>
[src]
Write a self-closing element like
fn elem_text(&mut self, name: &str, text: &str) -> Result<()>
[src]
Write an element with inlined text (escaped)
fn begin_elem(&mut self, name: &'a str) -> Result<()>
[src]
Begin an elem, make sure name contains only allowed chars
fn end_elem(&mut self) -> Result<()>
[src]
End and elem
fn empty_elem(&mut self, name: &'a str) -> Result<()>
[src]
Begin an empty elem
fn attr(&mut self, name: &str, value: &str) -> Result<()>
[src]
Write an attr, make sure name and value contain only allowed chars.
For an escaping version use attr_esc
fn attr_esc(&mut self, name: &str, value: &str) -> Result<()>
[src]
Write an attr, make sure name contains only allowed chars
fn text(&mut self, text: &str) -> Result<()>
[src]
Write a text, escapes the text automatically
fn write(&mut self, text: &str) -> Result<()>
[src]
Raw write, no escaping, no safety net, use at own risk
fn cdata(&mut self, cdata: &str) -> Result<()>
[src]
Write a CDATA
fn comment(&mut self, comment: &str) -> Result<()>
[src]
Write a comment
fn close(&mut self) -> Result<()>
[src]
Close all open elems
fn flush(&mut self) -> Result<()>
[src]
Flush the underlying Writer
fn into_inner(self) -> W
[src]
Consume the XmlWriter and return the inner Writer