pub enum Event<P>where
P: PosnInCharStream,{
StartDocument {
span: StreamCharSpan<P>,
version: usize,
},
EndDocument {
span: StreamCharSpan<P>,
},
StartElement {
span: StreamCharSpan<P>,
tag: Tag,
},
EndElement {
span: StreamCharSpan<P>,
name: Name,
},
Content {
span: StreamCharSpan<P>,
ctype: ContentType,
data: String,
},
ProcessingInstruction {
span: StreamCharSpan<P>,
name: NSNameId,
data: Option<String>,
},
Comment {
span: StreamCharSpan<P>,
data: String,
lengths: Vec<usize>,
},
}Expand description
A markup event occupying a [Span] on a stream
Variants§
StartDocument
The start of the document
Fields
span: StreamCharSpan<P>File position of start of the document
EndDocument
The end of the document
Fields
span: StreamCharSpan<P>File position of end of the document
StartElement
Denotes a beginning of an XML element.
Fields
span: StreamCharSpan<P>The span of the start element ‘tag’
EndElement
Denotes an end of an XML element.
Fields
span: StreamCharSpan<P>The span of the end element ‘tag’
Content
Denotes one part of the content of an element
Fields
span: StreamCharSpan<P>The span of the content
ctype: ContentTypeThe type of the content: raw, whitespace, needs unescaping
ProcessingInstruction
Denotes an XML processing instruction.
Fields
span: StreamCharSpan<P>The span of the PI
Comment
Denotes a comment.
Fields
span: StreamCharSpan<P>The span of the comment
Implementations§
Source§impl<P> Event<P>where
P: PosnInCharStream,
impl<P> Event<P>where
P: PosnInCharStream,
Sourcepub fn start_document(span: StreamCharSpan<P>, version: usize) -> Self
pub fn start_document(span: StreamCharSpan<P>, version: usize) -> Self
Create a StartDocument event
Sourcepub fn end_document(span: StreamCharSpan<P>) -> Self
pub fn end_document(span: StreamCharSpan<P>) -> Self
Create an EndDocument event
Sourcepub fn start_element(span: StreamCharSpan<P>, tag: Tag) -> Self
pub fn start_element(span: StreamCharSpan<P>, tag: Tag) -> Self
Create a StartElement event with a given Tag
Sourcepub fn end_element(span: StreamCharSpan<P>, name: Name) -> Self
pub fn end_element(span: StreamCharSpan<P>, name: Name) -> Self
Create an EndElement event with a given Name
Sourcepub fn comment(
span: StreamCharSpan<P>,
data: String,
lengths: Vec<usize>,
) -> Self
pub fn comment( span: StreamCharSpan<P>, data: String, lengths: Vec<usize>, ) -> Self
Create an event of a vec of comment strings
Sourcepub fn content(
span: StreamCharSpan<P>,
ctype: ContentType,
data: String,
) -> Self
pub fn content( span: StreamCharSpan<P>, ctype: ContentType, data: String, ) -> Self
Create an event of content of the given type
Sourcepub fn content_raw(span: StreamCharSpan<P>, data: String) -> Self
pub fn content_raw(span: StreamCharSpan<P>, data: String) -> Self
Create an event of raw content
Sourcepub fn content_int(span: StreamCharSpan<P>, data: String) -> Self
pub fn content_int(span: StreamCharSpan<P>, data: String) -> Self
Create an event of interpretable content
Sourcepub fn content_ws(span: StreamCharSpan<P>, data: String) -> Self
pub fn content_ws(span: StreamCharSpan<P>, data: String) -> Self
Create an event of whitespace content
Sourcepub fn borrow_span(&self) -> &StreamCharSpan<P>
pub fn borrow_span(&self) -> &StreamCharSpan<P>
Borrow the span of the event, for logging or errors etc.
Sourcepub fn as_start_document(&self) -> Option<usize>
pub fn as_start_document(&self) -> Option<usize>
Return Some(version number) if the Event is a StartDocument event; else return None
Sourcepub fn as_start_element(self) -> Option<Tag>
pub fn as_start_element(self) -> Option<Tag>
Return Some(Tag) if the Event is a StartElement event; else return None
Sourcepub fn as_end_element(&self) -> Option<&Name>
pub fn as_end_element(&self) -> Option<&Name>
Return Some(Name) if the Event is an EndElement event; else return None
Sourcepub fn as_content(&self) -> Option<(ContentType, &str)>
pub fn as_content(&self) -> Option<(ContentType, &str)>
Return Some(ContentType, string) if the Event is a Content event; else return None
Sourcepub fn is_start_document(&self) -> bool
pub fn is_start_document(&self) -> bool
Return true if the Event is a StartDocument event
Sourcepub fn is_end_document(&self) -> bool
pub fn is_end_document(&self) -> bool
Return true if the Event is an EndDocument event
Source§impl<P> Event<P>where
P: PosnInCharStream,
impl<P> Event<P>where
P: PosnInCharStream,
Sourcepub fn as_xml_writer<'a>(
&'a self,
ns: &'a NamespaceStack<'_>,
) -> Option<XmlEvent<'a>>
pub fn as_xml_writer<'a>( &'a self, ns: &'a NamespaceStack<'_>, ) -> Option<XmlEvent<'a>>
Get an [xml::writer::XmlEvent<’a>] from this Name
Sourcepub fn as_xml_reader(
&self,
ns: &NamespaceStack<'_>,
_fill_namespaces: bool,
) -> Option<XmlEvent>
pub fn as_xml_reader( &self, ns: &NamespaceStack<'_>, _fill_namespaces: bool, ) -> Option<XmlEvent>
Get an [xml::reader::XmlEvent<’a>] from this Name