Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml Inheritance: System.ValueTypeSyntax
Summary
Represents the XML declaration captured when an XmlDocument is parsed.Usage
XmlDeclarationInfo is what XmlDocument keeps of a document’s XML declaration: the version, the encoding, and the standalone flag. Read it from XmlDocument.Declaration, which is null when the document has no declaration.
Remarks
The value is immutable. Mutable trees useCloudNimble.Text.Xml.Nodes.XmlDeclarationNode instead.
Considerations
- The values are normalized, not copied from the source. For a parsed document,
Versionis1.0or1.1, andEncodingis alwaysutf-8, however the document spelled it. In the example, the source saysUTF-8. Standalonehas three states:trueforstandalone="yes",falseforstandalone="no", andnullwhen the declaration doesn’t say.- A missing declaration isn’t an error.
XmlDocument.Declarationisnull, and the document is XML 1.0. XmlDocumentproduces this type;Utf8XmlReaderreports a token. The reader reports the declaration as anXmlTokenType.XmlDeclarationtoken, with the version inUtf8XmlReader.Versionand the pseudo-attributes, as written, inValueSpan.- It’s an immutable value. In the tree that you can change, the declaration is a
CloudNimble.Text.Xml.Nodes.XmlDeclarationNode.
Constructors
.ctor
Initializes a new instance of the XmlDeclarationInfo struct.Syntax
Parameters
.ctor Inherited
Inherited from
System.ValueTypeSyntax
.ctor Inherited
Inherited from
objectSyntax
Properties
Encoding
Gets the encoding named in the declaration.Syntax
Property Value
Type:string
The name of the encoding. This is always utf-8 for a document that
XmlDocument parsed, because no other encoding is accepted.
Standalone
Gets the value of thestandalone pseudo-attribute of the declaration.
Syntax
Property Value
Type:bool?
true if the declaration says standalone="yes"; false if
it says standalone="no"; null if the pseudo-attribute is omitted.
Version
Gets the XML version named in the declaration.Syntax
Property Value
Type:string
The version string, which is 1.0 or 1.1 for a document that
XmlDocument parsed.
Methods
Equals Override
Inherited from
System.ValueTypeSyntax
Parameters
Returns
Type:bool
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
GetHashCode Override
Inherited from
System.ValueTypeSyntax
Returns
Type:int
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
ToString Override
Inherited from
System.ValueTypeSyntax
Returns
Type:string?
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Related APIs
- CloudNimble.Text.Xml.XmlDocument
- CloudNimble.Text.Xml.XmlVersion
- CloudNimble.Text.Xml.Utf8XmlReader
- CloudNimble.Text.Xml.XmlWriterOptions
- CloudNimble.Text.Xml.Nodes.XmlDeclarationNode