8 private const string YES =
"yes";
10 private const string NO =
"no";
12 private string version;
14 private string encoding;
16 private string standalone;
42 encoding = ((value ==
null) ?
string.Empty : value);
58 standalone =
string.Empty;
61 if (value.Length == 0 || value ==
"yes" || value ==
"no")
72 public override string Value 93 stringBuilder.
Append(
" encoding=\"");
95 stringBuilder.
Append(
"\"");
99 stringBuilder.
Append(
" standalone=\"");
101 stringBuilder.
Append(
"\"");
113 XmlLoader.ParseXmlDeclarationValue(value, out text, out text2, out text3);
116 if (text !=
null && !IsValidXmlVersion(text))
142 public override string Name =>
"xml";
160 if (!IsValidXmlVersion(version))
164 if (standalone !=
null && standalone.Length > 0 && standalone !=
"yes" && standalone !=
"no")
195 private bool IsValidXmlVersion(
string ver)
197 if (ver.Length >= 3 && ver[0] ==
'1' && ver[1] ==
'.')
199 return XmlCharType.IsOnlyDigits(ver, 2, ver.Length - 2);
Represents a character encoding.To browse the .NET Framework source code for this type,...
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Represents the XML declaration node <?xml version='1.0'...?>.
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
virtual XmlDocument OwnerDocument
Gets the T:System.Xml.XmlDocument to which this node belongs.
override void WriteTo(XmlWriter w)
Saves the node to the specified T:System.Xml.XmlWriter.
override string Value
Gets or sets the value of the XmlDeclaration.
internal XmlDeclaration(string version, string encoding, string standalone, XmlDocument doc)
Initializes a new instance of the T:System.Xml.XmlDeclaration class.
override string LocalName
Gets the local name of the node.
virtual XmlDeclaration CreateXmlDeclaration(string version, string encoding, string standalone)
Creates an T:System.Xml.XmlDeclaration node with the specified values.
XmlNodeType
Specifies the type of node.
override void WriteContentTo(XmlWriter w)
Saves the children of the node to the specified T:System.Xml.XmlWriter. Because XmlDeclaration nodes ...
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
string? Encoding
Gets or sets the encoding level of the XML document.
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
Gets the node immediately preceding or following this node.
string Standalone
Gets or sets the value of the standalone attribute.
Represents the version number of an assembly, operating system, or the common language runtime....
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
The exception that is thrown when one of the arguments provided to a method is not valid.
string Version
Gets the XML version of the document.
override XmlNode CloneNode(bool deep)
Creates a duplicate of this node.
abstract void WriteProcessingInstruction(string name, string text)
When overridden in a derived class, writes out a processing instruction with a space between the name...
override string InnerText
Gets or sets the concatenated values of the XmlDeclaration.
override XmlNodeType NodeType
Gets the type of the current node.
override string Name
Gets the qualified name of the node.
Represents a single node in the XML document.