pub enum Token<'a> {
Show 13 variants
Declaration(StrSpan<'a>, Option<StrSpan<'a>>, Option<bool>),
ProcessingInstruction(StrSpan<'a>, Option<StrSpan<'a>>),
Comment(StrSpan<'a>),
DtdStart(StrSpan<'a>, Option<ExternalId<'a>>),
EmptyDtd(StrSpan<'a>, Option<ExternalId<'a>>),
EntityDeclaration(StrSpan<'a>, EntityDefinition<'a>),
DtdEnd,
ElementStart(StrSpan<'a>, StrSpan<'a>),
Attribute((StrSpan<'a>, StrSpan<'a>), StrSpan<'a>),
ElementEnd(ElementEnd<'a>),
Text(StrSpan<'a>),
Whitespaces(StrSpan<'a>),
Cdata(StrSpan<'a>),
}
Expand description
An XML token.
Variants§
Declaration(StrSpan<'a>, Option<StrSpan<'a>>, Option<bool>)
Declaration token.
Version, encoding and standalone.
Example: <?xml version="1.0"?>
ProcessingInstruction(StrSpan<'a>, Option<StrSpan<'a>>)
Processing instruction token.
Example: <?target content?>
Comment(StrSpan<'a>)
The comment token.
Example: <!-- text -->
DtdStart(StrSpan<'a>, Option<ExternalId<'a>>)
DOCTYPE start token.
Example: <!DOCTYPE note [
EmptyDtd(StrSpan<'a>, Option<ExternalId<'a>>)
Empty DOCTYPE token.
Example: <!DOCTYPE note>
EntityDeclaration(StrSpan<'a>, EntityDefinition<'a>)
ENTITY token.
Can appear only inside the DTD.
Example: <!ENTITY ns_extend "http://test.com">
DtdEnd
DOCTYPE end token.
Example: ]>
ElementStart(StrSpan<'a>, StrSpan<'a>)
Element start token.
Contains prefix and local part of the qualified name.
Example: <elem
Attribute((StrSpan<'a>, StrSpan<'a>), StrSpan<'a>)
Attribute.
Contains prefix and local part of the qualified name and value.
Example: name="value"
ElementEnd(ElementEnd<'a>)
Element end token.
Text(StrSpan<'a>)
Text token.
Contains text between elements including whitespaces.
Basically everything between >
and <
.
Contains text as is. Use TextUnescape
to unescape it.
Example: <text>text</text>
Whitespaces(StrSpan<'a>)
Whitespaces token.
The same as Text
token, but contains only spaces.
Spaces can be encoded like  
.
Cdata(StrSpan<'a>)
CDATA token.
Example: <![CDATA[text]]>