quick_xml

Module events

Source
Expand description

Defines zero-copy XML events used throughout this library.

A XML event often represents part of a XML element. They occur both during reading and writing and are usually used with the stream-oriented API.

For example, the XML element

<name attr="value">Inner text</name>

consists of the three events Start, Text and End. They can also represent other parts in an XML document like the XML declaration. Each Event usually contains further information, like the tag name, the attribute or the inner text.

See Event for a list of all possible events.

§Reading

When reading a XML stream, the events are emitted by Reader::read_event and Reader::read_event_into. You must listen for the different types of events you are interested in.

See Reader for further information.

§Writing

When writing the XML document, you must create the XML element by constructing the events it consists of and pass them to the writer sequentially.

See Writer for further information.

Modules§

Structs§

  • CDATA content contains unescaped data from the reader. If you want to write them as a text, convert it to BytesText.
  • An XML declaration (Event::Decl).
  • Closing tag data (Event::End): </name>.
  • Processing instructions (PIs) allow documents to contain instructions for applications.
  • Opening tag data (Event::Start), with optional attributes: <name attr="value">.
  • Data from various events (most notably, Event::Text) that stored in XML in escaped form. Internally data is stored in escaped form.
  • Iterator over CDATA sections in a string.

Enums§