[][src]Trait xml5ever::serialize::Serializer

pub trait Serializer {
    fn start_elem<'a, AttrIter>(
        &mut self,
        name: QualName,
        attrs: AttrIter
    ) -> Result<(), Error>
    where
        AttrIter: Iterator<Item = (&'a QualName, &'a str)>
;
fn end_elem(&mut self, name: QualName) -> Result<(), Error>;
fn write_text(&mut self, text: &str) -> Result<(), Error>;
fn write_comment(&mut self, text: &str) -> Result<(), Error>;
fn write_doctype(&mut self, name: &str) -> Result<(), Error>;
fn write_processing_instruction(
        &mut self,
        target: &str,
        data: &str
    ) -> Result<(), Error>; }

Types that are capable of serializing implement this trait

Required methods

fn start_elem<'a, AttrIter>(
    &mut self,
    name: QualName,
    attrs: AttrIter
) -> Result<(), Error> where
    AttrIter: Iterator<Item = (&'a QualName, &'a str)>, 

Serialize the start of an element, for example <div class="test">.

fn end_elem(&mut self, name: QualName) -> Result<(), Error>

Serialize the end of an element, for example </div>.

fn write_text(&mut self, text: &str) -> Result<(), Error>

Serialize a plain text node.

fn write_comment(&mut self, text: &str) -> Result<(), Error>

Serialize a comment node, for example <!-- comment -->.

fn write_doctype(&mut self, name: &str) -> Result<(), Error>

Serialize a doctype node, for example <!doctype html>.

fn write_processing_instruction(
    &mut self,
    target: &str,
    data: &str
) -> Result<(), Error>

Serialize a processing instruction node, for example <?xml-stylesheet type="text/xsl" href="style.xsl"?>.

Loading content...

Implementors

impl<Wr: Write> Serializer for XmlSerializer<Wr>[src]

fn start_elem<'a, AttrIter>(
    &mut self,
    name: QualName,
    attrs: AttrIter
) -> Result<()> where
    AttrIter: Iterator<Item = AttrRef<'a>>, 
[src]

Serializes given start element into text. Start element contains qualified name and an attributes iterator.

fn end_elem(&mut self, name: QualName) -> Result<()>[src]

Serializes given end element into text.

fn write_comment(&mut self, text: &str) -> Result<()>[src]

Serializes comment into text.

fn write_doctype(&mut self, name: &str) -> Result<()>[src]

Serializes given doctype

fn write_text(&mut self, text: &str) -> Result<()>[src]

Serializes text for a node or an attributes.

fn write_processing_instruction(
    &mut self,
    target: &str,
    data: &str
) -> Result<()>
[src]

Serializes given processing instruction.

Loading content...