Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml Inheritance: System.EnumSyntax
Summary
Specifies the type of token that a Utf8XmlReader is positioned on in a UTF-8 XML document.Usage
After each call toUtf8XmlReader.Read that returns true, Utf8XmlReader.TokenType says what the reader is on. Switch on it to decide which members to read.
Remarks
Empty elements (<e/>) are reported as XmlTokenType.StartElement with
Utf8XmlReader.IsEmptyElement set. The reader does not synthesize an
XmlTokenType.EndElement token. Callers must check Utf8XmlReader.IsEmptyElement
before expecting a matching end tag.
Considerations
StartElementcovers<e>and<e/>. For an empty element,Utf8XmlReader.IsEmptyElementistrueand noEndElementtoken follows. Check it wherever you count depth or wait for an end tag.Attributenever comes fromRead.TokenTypeisAttributeonly between a call toMoveToNextAttributethat returnstrueand the next call toMoveToElementorRead.Commentis reported by default. SetXmlReaderOptions.CommentHandlingtoXmlCommentHandling.Skipwhen you don’t want comments.- White space between elements is a
Texttoken by default. SetXmlReaderOptions.WhitespaceHandlingtoXmlWhitespaceHandling.Insignificantwhen you don’t want it. The example in the usage section does both. White-space-only text that is content, such as the whole of<e> </e>, is aTexttoken under every setting. TextandCDatacarry the same kind of value. They differ only in how the document wrote it. Handle them together unless you need to know which form was used.XmlDeclarationcan only be the first token. A document doesn’t have to have one.Nonemeans there’s no current token: before the firstRead, and afterReadreturnsfalseat the end of the document.- A document type declaration throws. The reader rejects
<!DOCTYPEwith anXmlException(DTD is not allowed.) instead of reporting it.
Values
Related APIs
- CloudNimble.Text.Xml.Utf8XmlReader
- CloudNimble.Text.Xml.XmlReaderOptions
- CloudNimble.Text.Xml.XmlCommentHandling
- CloudNimble.Text.Xml.XmlWhitespaceHandling
- CloudNimble.Text.Xml.XmlValueKind