Enum svgparser::svg::Token
[−]
[src]
pub enum Token<'a> { Declaration(&'a str, Option<&'a str>, Option<&'a str>), ProcessingInstruction(&'a str, Option<&'a str>), EntityDeclaration(&'a str, StrSpan<'a>), Comment(&'a str), ElementStart(TagName<'a>), ElementEnd(ElementEnd<'a>), Attribute(AttrName<'a>, StrSpan<'a>), Text(StrSpan<'a>), Cdata(StrSpan<'a>), Whitespaces(&'a str), }
SVG token.
Variants
Declaration(&'a str, Option<&'a str>, Option<&'a str>)
XML declaration token.
Example: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
->
("1.0", "UTF-8", "yes")
ProcessingInstruction(&'a str, Option<&'a str>)
XML processing instruction token.
Example: <?target content?>
-> ("target", "content")
EntityDeclaration(&'a str, StrSpan<'a>)
The ENTITY token.
Can appear only inside the DTD. We emit only entities with EntityValue. ExternalID skipped.
Example: <!ENTITY ns_extend "http://test.com">
-> ("ns_extend", "http://test.com")
Comment(&'a str)
Comment token.
Example: <!-- text -->
-> " text "
ElementStart(TagName<'a>)
Element start token.
Example:
<nonsvg ...
-> "nonsvg"
<svg ...
-> ElementId::SVG
ElementEnd(ElementEnd<'a>)
Element end token.
See ElementEnd
doc for example.
Attribute(AttrName<'a>, StrSpan<'a>)
Attribute token.
Example:
name="value"
-> ("name", "value")
fill="red"
-> (AttributeId::Fill, "red")
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>
-> "text"
Cdata(StrSpan<'a>)
CDATA token.
Example: <![CDATA[text]]>
-> "text"
Whitespaces(&'a str)
Whitespaces token.
It will contain only whitespace characters like \n \t\r
and escaped version of them, like  
.
If there is a text between elements - Whitespace
will not be emitted at all.
Example: <rect/>\n<rect/>
-> "\n"