pub enum Token<'a> {
Declaration {
version: StrSpan<'a>,
encoding: Option<StrSpan<'a>>,
standalone: Option<bool>,
span: StrSpan<'a>,
},
ProcessingInstruction {
target: StrSpan<'a>,
content: Option<StrSpan<'a>>,
span: StrSpan<'a>,
},
Comment {
text: StrSpan<'a>,
span: StrSpan<'a>,
},
DtdStart {
name: StrSpan<'a>,
external_id: Option<ExternalId<'a>>,
span: StrSpan<'a>,
},
EmptyDtd {
name: StrSpan<'a>,
external_id: Option<ExternalId<'a>>,
span: StrSpan<'a>,
},
EntityDeclaration {
name: StrSpan<'a>,
definition: EntityDefinition<'a>,
span: StrSpan<'a>,
},
DtdEnd {
span: StrSpan<'a>,
},
ElementStart {
prefix: StrSpan<'a>,
local: StrSpan<'a>,
span: StrSpan<'a>,
},
Attribute {
prefix: StrSpan<'a>,
local: StrSpan<'a>,
value: StrSpan<'a>,
span: StrSpan<'a>,
},
ElementEnd {
end: ElementEnd<'a>,
span: StrSpan<'a>,
},
Text {
text: StrSpan<'a>,
},
Cdata {
text: StrSpan<'a>,
span: StrSpan<'a>,
},
}
Expand description
An XML token.
Variants§
Declaration
Declaration token.
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
--- - version
----- - encoding?
--- - standalone?
------------------------------------------------------- - span
Fields
ProcessingInstruction
Processing instruction token.
<?target content?>
------ - target
------- - content?
------------------ - span
Comment
Comment token.
<!-- text -->
------ - text
------------- - span
DtdStart
DOCTYPE start token.
<!DOCTYPE greeting SYSTEM "hello.dtd" [
-------- - name
------------------ - external_id?
--------------------------------------- - span
EmptyDtd
Empty DOCTYPE token.
<!DOCTYPE greeting SYSTEM "hello.dtd">
-------- - name
------------------ - external_id?
-------------------------------------- - span
EntityDeclaration
ENTITY token.
Can appear only inside the DTD.
<!ENTITY ns_extend "http://test.com">
--------- - name
--------------- - definition
------------------------------------- - span
DtdEnd
DOCTYPE end token.
<!DOCTYPE svg [
...
]>
-- - span
ElementStart
Element start token.
<ns:elem attr="value"/>
-- - prefix
---- - local
-------- - span
Attribute
Attribute token.
<elem ns:attr="value"/>
-- - prefix
---- - local
----- - value
--------------- - span
ElementEnd
Element end token.
<ns:elem>text</ns:elem>
- ElementEnd::Open
- - span
<ns:elem>text</ns:elem>
-- ---- - ElementEnd::Close(prefix, local)
---------- - span
<ns:elem/>
- ElementEnd::Empty
-- - span
Text
Text token.
Contains text between elements including whitespaces.
Basically everything between >
and <
.
Except ]]>
, which is not allowed and will lead to an error.
<p> text </p>
------ - text
The token span is equal to the text
.
Cdata
CDATA token.
<p><![CDATA[text]]></p>
---- - text
---------------- - span
Implementations§
Trait Implementations§
impl<'a> Copy for Token<'a>
impl<'a> Eq for Token<'a>
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)