Enum xmlparser::Token

source ·
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 &#x20.

§

Cdata(StrSpan<'a>)

CDATA token.

Example: <![CDATA[text]]>

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.