Enum xml::reader::events::XmlEvent [] [src]

pub enum XmlEvent {
    StartDocument {
        version: XmlVersion,
        encoding: String,
        standalone: Option<bool>,
    },
    EndDocument,
    ProcessingInstruction {
        name: String,
        data: Option<String>,
    },
    StartElement {
        name: OwnedName,
        attributes: Vec<OwnedAttribute>,
        namespace: Namespace,
    },
    EndElement {
        name: OwnedName,
    },
    CData(String),
    Comment(String),
    Characters(String),
    Whitespace(String),
    Error(CommonError),
}

An element of an XML input stream.

Items of this enum are emitted by reader::EventReader. They correspond to different elements of an XML document.

Variants

StartDocument

Corresponds to XML document declaration.

This event is always emitted before any other event (except Error). It is emitted even if the actual declaration is not present in the document.

Fields

version

XML version.

If XML declaration is not present, defaults to Version10.

encoding

XML document encoding.

If XML declaration is not present or does not contain encoding attribute, defaults to "UTF-8". This field is currently used for no other purpose than informational.

standalone

XML standalone declaration.

If XML document is not present or does not contain standalone attribute, defaults to None. This field is currently used for no other purpose than informational.

EndDocument

Denotes to the end of the document stream.

This event is always emitted after any other event (except Error). After it is emitted for the first time, it will always be emitted on next event pull attempts.

ProcessingInstruction

Denotes an XML processing instruction.

This event contains a processing instruction target (name) and opaque data. It is up to the application to process them.

Fields

name

Processing instruction target.

data

Processing instruction content.

StartElement

Denotes a beginning of an XML element.

This event is emitted after parsing opening tags or after parsing bodiless tags. In the latter case EndElement event immediately follows.

Fields

name

Qualified name of the element.

attributes

A list of attributes associated with the element.

Currently attributes are not checked for duplicates (TODO)

namespace

Contents of the namespace mapping at this point of the document.

EndElement

Denotes an end of an XML document.

This event is emitted after parsing closing tags or after parsing bodiless tags. In the latter case it is emitted immediately after corresponding StartElement event.

Fields

name

Qualified name of the element.

CData

Denotes CDATA content.

This event contains unparsed data. No unescaping will be performed.

It is possible to configure a parser to emit Characters event instead of CData. See pull::ParserConfiguration structure for more information.

Comment

Denotes a comment.

It is possible to configure a parser to ignore comments, so this event will never be emitted. See pull::ParserConfiguration structure for more information.

Characters

Denotes character data outside of tags.

Contents of this event will always be unescaped, so no entities like &lt; or &amp; or &#123; will appear in it.

It is possible to configure a parser to trim leading and trailing whitespace for this event. See pull::ParserConfiguration structure for more information.

Whitespace

Denotes a chunk of whitespace outside of tags.

It is possible to configure a parser to emit Characters event instead of Whitespace. See pull::ParserConfiguration structure for more information. When combined with whitespace trimming, it will eliminate standalone whitespace from the event stream completely.

Error

Denotes parsing error.

This event will always be the last event in the stream; no further XML processing will be done as is required by XML specification, section 1.2.

Methods

impl XmlEvent

fn as_writer_event<'a>(&'a self) -> Option<XmlEvent<'a>>

Trait Implementations

impl Debug for XmlEvent

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl Clone for XmlEvent

fn clone(&self) -> XmlEvent

fn clone_from(&mut self, source: &Self)

impl PartialEq for XmlEvent

fn eq(&self, __arg_0: &XmlEvent) -> bool

fn ne(&self, __arg_0: &XmlEvent) -> bool