Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml Inheritance: System.EnumSyntax
Summary
Specifies the version of the XML recommendation that is in force for a document.Usage
XmlVersion names the version of XML whose rules apply to a document. You meet it in two places.
When you read, you don’t set it. Utf8XmlReader takes the version from the XML declaration, reports it in Utf8XmlReader.Version, and applies that version’s rules to the rest of the document. A document with no declaration is XML 1.0.
XmlWriterOptions.Version. The writer puts the version in the declaration and applies that version’s character rules to what you write.
Remarks
Utf8XmlReader takes the version from the XML declaration. An omitted declaration means XmlVersion.Version10. XML 1.1 is not a superset of 1.0: NEL and LS are line endings only in 1.1, RestrictedChar must be a character reference in 1.1, andxmlns:p="" is
legal only in Namespaces in XML 1.1.
Considerations
XML 1.1 isn’t a superset of XML 1.0. The same bytes can mean different things in the two versions, which is why the library tracks the version instead of treating every document alike.
Other things to know:
Version10is the default for the writer, and for a reader until it has read a declaration that says otherwise.- U+0000 isn’t allowed in either version.
- Write XML 1.1 only when your data needs it. Not every XML tool reads it.
- A version number other than
1.1is read as XML 1.0, provided it has the form1.x. - The version survives reading in blocks.
XmlReaderStatecarries it from one reader to the next.
Values
Related APIs
- CloudNimble.Text.Xml.Utf8XmlReader
- CloudNimble.Text.Xml.Utf8XmlWriter
- CloudNimble.Text.Xml.XmlWriterOptions
- CloudNimble.Text.Xml.XmlDeclarationInfo
- CloudNimble.Text.Xml.XmlReaderState