mscorlib(4.0.0.0) API with additions
System.Xml.XmlDeclaration Class Reference

Represents the XML declaration node <?xml version='1.0'...?>. More...

Inheritance diagram for System.Xml.XmlDeclaration:
[legend]
Collaboration diagram for System.Xml.XmlDeclaration:
[legend]

Public Member Functions

override XmlNode CloneNode (bool deep)
 Creates a duplicate of this node. More...
 
override void WriteTo (XmlWriter w)
 Saves the node to the specified T:System.Xml.XmlWriter. More...
 
override void WriteContentTo (XmlWriter w)
 Saves the children of the node to the specified T:System.Xml.XmlWriter. Because XmlDeclaration nodes do not have children, this method has no effect. More...
 
- Public Member Functions inherited from System.Xml.XmlNode
virtual XPathNavigator CreateNavigator ()
 Creates an T:System.Xml.XPath.XPathNavigator for navigating this object. More...
 
XmlNode SelectSingleNode (string xpath)
 Selects the first XmlNode that matches the XPath expression. More...
 
XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
 Selects the first XmlNode that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied T:System.Xml.XmlNamespaceManager. More...
 
XmlNodeList SelectNodes (string xpath)
 Selects a list of nodes matching the XPath expression. More...
 
XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
 Selects a list of nodes matching the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied T:System.Xml.XmlNamespaceManager. More...
 
virtual XmlNode InsertBefore (XmlNode newChild, XmlNode refChild)
 Inserts the specified node immediately before the specified reference node. More...
 
virtual XmlNode InsertAfter (XmlNode newChild, XmlNode refChild)
 Inserts the specified node immediately after the specified reference node. More...
 
virtual XmlNode ReplaceChild (XmlNode newChild, XmlNode oldChild)
 Replaces the child node oldChild with newChild node. More...
 
virtual XmlNode RemoveChild (XmlNode oldChild)
 Removes specified child node. More...
 
virtual XmlNode PrependChild (XmlNode newChild)
 Adds the specified node to the beginning of the list of child nodes for this node. More...
 
virtual XmlNode AppendChild (XmlNode newChild)
 Adds the specified node to the end of the list of child nodes, of this node. More...
 
virtual void Normalize ()
 Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes. More...
 
virtual bool Supports (string feature, string version)
 Tests if the DOM implementation implements a specific feature. More...
 
virtual XmlNode Clone ()
 Creates a duplicate of this node. More...
 
IEnumerator GetEnumerator ()
 Get an enumerator that iterates through the child nodes in the current node. More...
 
virtual void RemoveAll ()
 Removes all the child nodes and/or attributes of the current node. More...
 
virtual string GetNamespaceOfPrefix (string prefix)
 Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration. More...
 
virtual string GetPrefixOfNamespace (string namespaceURI)
 Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration. More...
 

Public Attributes

override string Name => "xml"
 Gets the qualified name of the node. More...
 
override string LocalName => Name
 Gets the local name of the node. More...
 
override XmlNodeType NodeType => XmlNodeType.XmlDeclaration
 Gets the type of the current node. More...
 
- Public Attributes inherited from System.Xml.XmlNode
virtual XmlNodeList ChildNodes => new XmlChildNodes(this)
 Gets all the child nodes of the node. More...
 
virtual XmlNode PreviousSibling => null
 Gets the node immediately preceding this node. More...
 
virtual XmlNode NextSibling => null
 Gets the node immediately following this node. More...
 
virtual XmlAttributeCollection Attributes => null
 Gets an T:System.Xml.XmlAttributeCollection containing the attributes of this node. More...
 
virtual XmlNode FirstChild => LastNode?.next
 Gets the first child of the node. More...
 
virtual XmlNode LastChild => LastNode
 Gets the last child of the node. More...
 
virtual bool HasChildNodes => LastNode != null
 Gets a value indicating whether this node has any child nodes. More...
 
virtual string NamespaceURI => string.Empty
 Gets the namespace URI of this node. More...
 
virtual IXmlSchemaInfo SchemaInfo => XmlDocument.NotKnownSchemaInfo
 Gets the post schema validation infoset that has been assigned to this node as a result of schema validation. More...
 
virtual XmlNode PreviousText => null
 Gets the text node that immediately precedes this node. More...
 

Protected Member Functions

internal XmlDeclaration (string version, string encoding, string standalone, XmlDocument doc)
 Initializes a new instance of the T:System.Xml.XmlDeclaration class. More...
 

Properties

string Version [get, set]
 Gets the XML version of the document. More...
 
string? Encoding [get, set]
 Gets or sets the encoding level of the XML document. More...
 
string Standalone [get, set]
 Gets or sets the value of the standalone attribute. More...
 
override string Value [get, set]
 Gets or sets the value of the XmlDeclaration. More...
 
override string InnerText [get, set]
 Gets or sets the concatenated values of the XmlDeclaration. More...
 
- Properties inherited from System.Xml.XmlLinkedNode
override XmlNode PreviousSibling [get]
 Gets the node immediately preceding this node. More...
 
override XmlNode NextSibling [get]
 Gets the node immediately following this node. More...
 
- Properties inherited from System.Xml.XmlNode
abstract string Name [get]
 Gets the qualified name of the node, when overridden in a derived class. More...
 
virtual string Value [get, set]
 Gets or sets the value of the node. More...
 
abstract XmlNodeType NodeType [get]
 Gets the type of the current node, when overridden in a derived class. More...
 
virtual XmlNode ParentNode [get]
 Gets the parent of this node (for nodes that can have parents). More...
 
virtual XmlDocument OwnerDocument [get]
 Gets the T:System.Xml.XmlDocument to which this node belongs. More...
 
virtual string Prefix [get, set]
 Gets or sets the namespace prefix of this node. More...
 
abstract string LocalName [get]
 Gets the local name of the node, when overridden in a derived class. More...
 
virtual bool IsReadOnly [get]
 Gets a value indicating whether the node is read-only. More...
 
virtual string InnerText [get, set]
 Gets or sets the concatenated values of the node and all its child nodes. More...
 
virtual string OuterXml [get]
 Gets the markup containing this node and all its child nodes. More...
 
virtual string InnerXml [get, set]
 Gets or sets the markup representing only the child nodes of this node. More...
 
virtual string BaseURI [get]
 Gets the base URI of the current node. More...
 
virtual XmlElement this[string name] [get]
 Gets the first child element with the specified P:System.Xml.XmlNode.Name. More...
 
virtual XmlElement this[string localname, string ns] [get]
 Gets the first child element with the specified P:System.Xml.XmlNode.LocalName and P:System.Xml.XmlNode.NamespaceURI. More...
 

Detailed Description

Represents the XML declaration node <?xml version='1.0'...?>.

Definition at line 6 of file XmlDeclaration.cs.

Constructor & Destructor Documentation

◆ XmlDeclaration()

internal System.Xml.XmlDeclaration.XmlDeclaration ( string  version,
string  encoding,
string  standalone,
XmlDocument  doc 
)
protected

Initializes a new instance of the T:System.Xml.XmlDeclaration class.

Parameters
versionThe XML version; see the P:System.Xml.XmlDeclaration.Version property.
encodingThe encoding scheme; see the P:System.Xml.XmlDeclaration.Encoding property.
standaloneIndicates whether the XML document depends on an external DTD; see the P:System.Xml.XmlDeclaration.Standalone property.
docThe parent XML document.

Definition at line 157 of file XmlDeclaration.cs.

Member Function Documentation

◆ CloneNode()

override XmlNode System.Xml.XmlDeclaration.CloneNode ( bool  deep)
virtual

Creates a duplicate of this node.

Parameters
deeptrue to recursively clone the subtree under the specified node; false to clone only the node itself. Because XmlDeclaration nodes do not have children, the cloned node always includes the data value, regardless of the parameter setting.
Returns
The cloned node.

Implements System.Xml.XmlNode.

Definition at line 177 of file XmlDeclaration.cs.

◆ WriteContentTo()

override void System.Xml.XmlDeclaration.WriteContentTo ( XmlWriter  w)
virtual

Saves the children of the node to the specified T:System.Xml.XmlWriter. Because XmlDeclaration nodes do not have children, this method has no effect.

Parameters
wThe XmlWriter to which you want to save.

Implements System.Xml.XmlNode.

Definition at line 191 of file XmlDeclaration.cs.

◆ WriteTo()

override void System.Xml.XmlDeclaration.WriteTo ( XmlWriter  w)
virtual

Saves the node to the specified T:System.Xml.XmlWriter.

Parameters
wThe XmlWriter to which you want to save.

Implements System.Xml.XmlNode.

Definition at line 184 of file XmlDeclaration.cs.

Member Data Documentation

◆ LocalName

override string System.Xml.XmlDeclaration.LocalName => Name

Gets the local name of the node.

Returns
For XmlDeclaration nodes, the local name is xml.

Definition at line 146 of file XmlDeclaration.cs.

◆ Name

override string System.Xml.XmlDeclaration.Name => "xml"

Gets the qualified name of the node.

Returns
For XmlDeclaration nodes, the name is xml.

Definition at line 142 of file XmlDeclaration.cs.

◆ NodeType

override XmlNodeType System.Xml.XmlDeclaration.NodeType => XmlNodeType.XmlDeclaration

Gets the type of the current node.

Returns
For XmlDeclaration nodes, this value is XmlNodeType.XmlDeclaration.

Definition at line 150 of file XmlDeclaration.cs.

Property Documentation

◆ Encoding

string? System.Xml.XmlDeclaration.Encoding
getset

Gets or sets the encoding level of the XML document.

Returns
The valid character encoding name. The most commonly supported character encoding names for XML are the following: Category Encoding Names Unicode UTF-8, UTF-16 ISO 10646 ISO-10646-UCS-2, ISO-10646-UCS-4 ISO 8859 ISO-8859-n (where "n" is a digit from 1 to 9) JIS X-0208-1997 ISO-2022-JP, Shift_JIS, EUC-JP This value is optional. If a value is not set, this property returns String.Empty.If an encoding attribute is not included, UTF-8 encoding is assumed when the document is written or saved out.

Definition at line 35 of file XmlDeclaration.cs.

◆ InnerText

override string System.Xml.XmlDeclaration.InnerText
getset

Gets or sets the concatenated values of the XmlDeclaration.

Returns
The concatenated values of the XmlDeclaration (that is, everything between <?xml and ?>).

Definition at line 87 of file XmlDeclaration.cs.

◆ Standalone

string System.Xml.XmlDeclaration.Standalone
getset

Gets or sets the value of the standalone attribute.

Returns
Valid values are yes if all entity declarations required by the XML document are contained within the document or no if an external document type definition (DTD) is required. If a standalone attribute is not present in the XML declaration, this property returns String.Empty.

Definition at line 49 of file XmlDeclaration.cs.

◆ Value

override string System.Xml.XmlDeclaration.Value
getset

Gets or sets the value of the XmlDeclaration.

Returns
The contents of the XmlDeclaration (that is, everything between <?xml and ?>).

Definition at line 73 of file XmlDeclaration.cs.

◆ Version

string System.Xml.XmlDeclaration.Version
getset

Gets the XML version of the document.

Returns
The value is always 1.0.

Definition at line 21 of file XmlDeclaration.cs.


The documentation for this class was generated from the following file: