pub enum Event {
XmlDeclaration(EventMetrics, XmlVersion),
StartElement(EventMetrics, QName, AttrMap),
EndElement(EventMetrics),
Text(EventMetrics, String),
}Expand description
§High-level, logical XML document parts
The term Event is borrowed from SAX terminology. Each Event
refers to a bit of the XML document which has been parsed.
In contrast to the RawEvent, observing a Event from a
Parser guarantees that the XML document has been well-formed and
namespace-well-formed up to this point (for the caveats which, in contrast,
exist about observing a RawEvent, see RawParser).
Each event has EventMetrics attached which give information about the
number of bytes from the input stream used to generate the event.
Variants§
XmlDeclaration(EventMetrics, XmlVersion)
The XML declaration.
This mirrors RawEvent::XmlDeclaration.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
This includes all bytes from the opening <? until and including
the closing ?>.
1: XmlVersionXML version number
StartElement(EventMetrics, QName, AttrMap)
The start of an XML element.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
If this is the root element, this also includes any whitespace between the XML declaration and the start of the root element.
EndElement(EventMetrics)
The end of an XML element.
The parser enforces that start/end pairs are correctly nested.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
The number of bytes may be zero if this event is emitted in
response to a /> in an element header, because the bytes for
/> are accounted for in the corresponding
Self::StartElement.
Text(EventMetrics, String)
Text CData.
This mirrors RawEvent::Text.
Note: Multiple consecutive Text events may be emitted for long
sections of text or because of implementation details in the
processing.
Tuple Fields
0: EventMetricsNumber of bytes contributing to this event.
Note that due to the expansion of character references and the processing of CDATA sections, the number of bytes consumed will generally be not equal to the number of bytes in emitted.
Implementations§
Source§impl Event
impl Event
Sourcepub fn metrics(&self) -> &EventMetrics
pub fn metrics(&self) -> &EventMetrics
Return the EventMetrics of the event