mscorlib(4.0.0.0) API with additions
System.Xml.XmlNode Class Referenceabstract

Represents a single node in the XML document. More...

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

Public Member Functions

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...
 
abstract XmlNode CloneNode (bool deep)
 Creates a duplicate of the node, when overridden in a derived class. 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...
 
abstract void WriteTo (XmlWriter w)
 Saves the current node to the specified T:System.Xml.XmlWriter, when overridden in a derived class. More...
 
abstract void WriteContentTo (XmlWriter w)
 Saves all the child nodes of the node to the specified T:System.Xml.XmlWriter, when overridden in a derived class. 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

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...
 

Properties

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 a single node in the XML document.

Definition at line 13 of file XmlNode.cs.

Member Function Documentation

◆ AppendChild()

virtual XmlNode System.Xml.XmlNode.AppendChild ( XmlNode  newChild)
virtual

Adds the specified node to the end of the list of child nodes, of this node.

Parameters
newChildThe node to add. All the contents of the node to be added are moved into the specified location.
Returns
The node added.
Exceptions
T:System.InvalidOperationExceptionThis node is of a type that does not allow child nodes of the type of the newChild node.The newChild is an ancestor of this node.
T:System.ArgumentExceptionThe newChild was created from a different document than the one that created this node.This node is read-only.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 833 of file XmlNode.cs.

◆ Clone()

virtual XmlNode System.Xml.XmlNode.Clone ( )
virtual

Creates a duplicate of this node.

Returns
The cloned node.

Implements System.ICloneable.

Definition at line 1090 of file XmlNode.cs.

◆ CloneNode()

abstract XmlNode System.Xml.XmlNode.CloneNode ( bool  deep)
pure virtual

Creates a duplicate of the node, when overridden in a derived class.

Parameters
deeptrue to recursively clone the subtree under the specified node; false to clone only the node itself.
Returns
The cloned node.
Exceptions
T:System.InvalidOperationExceptionCalling this method on a node type that cannot be cloned.

Implemented in System.Xml.XmlDocument, System.Xml.XmlElement, System.Xml.XmlAttribute, System.Xml.XmlDeclaration, System.Xml.XmlDocumentType, System.Xml.XmlEntity, System.Xml.XmlProcessingInstruction, System.Xml.XmlSignificantWhitespace, System.Xml.XmlWhitespace, System.Xml.XmlText, System.Xml.XmlEntityReference, System.Xml.XmlCDataSection, System.Xml.XmlDocumentFragment, System.Xml.XmlNotation, and System.Xml.XmlComment.

◆ CreateNavigator()

virtual XPathNavigator System.Xml.XmlNode.CreateNavigator ( )
virtual

Creates an T:System.Xml.XPath.XPathNavigator for navigating this object.

Returns
An XPathNavigator object used to navigate the node. The XPathNavigator is positioned on the node from which the method was called. It is not positioned on the root of the document.

Implements System.Xml.XPath.IXPathNavigable.

Reimplemented in System.Xml.XmlDocument.

Definition at line 416 of file XmlNode.cs.

◆ GetEnumerator()

IEnumerator System.Xml.XmlNode.GetEnumerator ( )

Get an enumerator that iterates through the child nodes in the current node.

Returns
An T:System.Collections.IEnumerator object that can be used to iterate through the child nodes in the current node.

Implements System.Collections.IEnumerable.

Definition at line 1111 of file XmlNode.cs.

◆ GetNamespaceOfPrefix()

virtual string System.Xml.XmlNode.GetNamespaceOfPrefix ( string  prefix)
virtual

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.

Parameters
prefixThe prefix whose namespace URI you want to find.
Returns
The namespace URI of the specified prefix.

Definition at line 1158 of file XmlNode.cs.

◆ GetPrefixOfNamespace()

virtual string System.Xml.XmlNode.GetPrefixOfNamespace ( string  namespaceURI)
virtual

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.

Parameters
namespaceURIThe namespace URI whose prefix you want to find.
Returns
The prefix for the specified namespace URI.

Definition at line 1243 of file XmlNode.cs.

◆ InsertAfter()

virtual XmlNode System.Xml.XmlNode.InsertAfter ( XmlNode  newChild,
XmlNode  refChild 
)
virtual

Inserts the specified node immediately after the specified reference node.

Parameters
newChildThe XmlNode to insert.
refChildThe XmlNode that is the reference node. The newNode is placed after the refNode .
Returns
The node being inserted.
Exceptions
T:System.InvalidOperationExceptionThis node is of a type that does not allow child nodes of the type of the newChild node.The newChild is an ancestor of this node.
T:System.ArgumentExceptionThe newChild was created from a different document than the one that created this node.The refChild is not a child of this node.This node is read-only.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 623 of file XmlNode.cs.

◆ InsertBefore()

virtual XmlNode System.Xml.XmlNode.InsertBefore ( XmlNode  newChild,
XmlNode  refChild 
)
virtual

Inserts the specified node immediately before the specified reference node.

Parameters
newChildThe XmlNode to insert.
refChildThe XmlNode that is the reference node. The newChild is placed before this node.
Returns
The node being inserted.
Exceptions
T:System.InvalidOperationExceptionThe current node is of a type that does not allow child nodes of the type of the newChild node.The newChild is an ancestor of this node.
T:System.ArgumentExceptionThe newChild was created from a different document than the one that created this node.The refChild is not a child of this node.This node is read-only.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 514 of file XmlNode.cs.

◆ Normalize()

virtual void System.Xml.XmlNode.Normalize ( )
virtual

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.

Definition at line 976 of file XmlNode.cs.

◆ PrependChild()

virtual XmlNode System.Xml.XmlNode.PrependChild ( XmlNode  newChild)
virtual

Adds the specified node to the beginning of the list of child nodes for this node.

Parameters
newChildThe node to add. All the contents of the node to be added are moved into the specified location.
Returns
The node added.
Exceptions
T:System.InvalidOperationExceptionThis node is of a type that does not allow child nodes of the type of the newChild node.The newChild is an ancestor of this node.
T:System.ArgumentExceptionThe newChild was created from a different document than the one that created this node.This node is read-only.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 823 of file XmlNode.cs.

◆ RemoveAll()

virtual void System.Xml.XmlNode.RemoveAll ( )
virtual

Removes all the child nodes and/or attributes of the current node.

Reimplemented in System.Xml.XmlElement.

Definition at line 1143 of file XmlNode.cs.

◆ RemoveChild()

virtual XmlNode System.Xml.XmlNode.RemoveChild ( XmlNode  oldChild)
virtual

Removes specified child node.

Parameters
oldChildThe node being removed.
Returns
The node removed.
Exceptions
T:System.ArgumentExceptionThe oldChild is not a child of this node. Or this node is read-only.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 746 of file XmlNode.cs.

◆ ReplaceChild()

virtual XmlNode System.Xml.XmlNode.ReplaceChild ( XmlNode  newChild,
XmlNode  oldChild 
)
virtual

Replaces the child node oldChild with newChild node.

Parameters
newChildThe new node to put in the child list.
oldChildThe node being replaced in the list.
Returns
The node replaced.
Exceptions
T:System.InvalidOperationExceptionThis node is of a type that does not allow child nodes of the type of the newChild node.The newChild is an ancestor of this node.
T:System.ArgumentExceptionThe newChild was created from a different document than the one that created this node.This node is read-only.The oldChild is not a child of this node.

Reimplemented in System.Xml.XmlAttribute.

Definition at line 734 of file XmlNode.cs.

◆ SelectNodes() [1/2]

XmlNodeList System.Xml.XmlNode.SelectNodes ( string  xpath)

Selects a list of nodes matching the XPath expression.

Parameters
xpathThe XPath expression.
Returns
An T:System.Xml.XmlNodeList containing a collection of nodes matching the XPath query.
Exceptions
T:System.Xml.XPath.XPathExceptionThe XPath expression contains a prefix. See XPath Examples.

Definition at line 457 of file XmlNode.cs.

◆ SelectNodes() [2/2]

XmlNodeList System.Xml.XmlNode.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.

Parameters
xpathThe XPath expression. See XPath Examples.
nsmgrAn T:System.Xml.XmlNamespaceManager to use for resolving namespaces for prefixes in the XPath expression.
Returns
An T:System.Xml.XmlNodeList containing a collection of nodes matching the XPath query.
Exceptions
T:System.Xml.XPath.XPathExceptionThe XPath expression contains a prefix which is not defined in the XmlNamespaceManager.

Definition at line 472 of file XmlNode.cs.

◆ SelectSingleNode() [1/2]

XmlNode System.Xml.XmlNode.SelectSingleNode ( string  xpath)

Selects the first XmlNode that matches the XPath expression.

Parameters
xpathThe XPath expression. See XPath Examples.
Returns
The first XmlNode that matches the XPath query or null if no matching node is found.
Exceptions
T:System.Xml.XPath.XPathExceptionThe XPath expression contains a prefix.

Definition at line 431 of file XmlNode.cs.

◆ SelectSingleNode() [2/2]

XmlNode System.Xml.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.

Parameters
xpathThe XPath expression. See XPath Examples.
nsmgrAn T:System.Xml.XmlNamespaceManager to use for resolving namespaces for prefixes in the XPath expression.
Returns
The first XmlNode that matches the XPath query or null if no matching node is found.
Exceptions
T:System.Xml.XPath.XPathExceptionThe XPath expression contains a prefix which is not defined in the XmlNamespaceManager.

Definition at line 441 of file XmlNode.cs.

◆ Supports()

virtual bool System.Xml.XmlNode.Supports ( string  feature,
string  version 
)
virtual

Tests if the DOM implementation implements a specific feature.

Parameters
featureThe package name of the feature to test. This name is not case-sensitive.
versionThe version number of the package name to test. If the version is not specified (null), supporting any version of the feature causes the method to return true.
Returns
true if the feature is implemented in the specified version; otherwise, false. The following table describes the combinations that return true.Feature Version XML 1.0 XML 2.0

Definition at line 1059 of file XmlNode.cs.

◆ WriteContentTo()

abstract void System.Xml.XmlNode.WriteContentTo ( XmlWriter  w)
pure virtual

◆ WriteTo()

Member Data Documentation

◆ Attributes

virtual XmlAttributeCollection System.Xml.XmlNode.Attributes => null

Gets an T:System.Xml.XmlAttributeCollection containing the attributes of this node.

Returns
An XmlAttributeCollection containing the attributes of the node.If the node is of type XmlNodeType.Element, the attributes of the node are returned. Otherwise, this property returns null.

Definition at line 99 of file XmlNode.cs.

◆ ChildNodes

virtual XmlNodeList System.Xml.XmlNode.ChildNodes => new XmlChildNodes(this)

Gets all the child nodes of the node.

Returns
An object that contains all the child nodes of the node.If there are no child nodes, this property returns an empty T:System.Xml.XmlNodeList.

Definition at line 87 of file XmlNode.cs.

◆ FirstChild

virtual XmlNode System.Xml.XmlNode.FirstChild => LastNode?.next

Gets the first child of the node.

Returns
The first child of the node. If there is no such node, null is returned.

Definition at line 117 of file XmlNode.cs.

◆ HasChildNodes

virtual bool System.Xml.XmlNode.HasChildNodes => LastNode != null

Gets a value indicating whether this node has any child nodes.

Returns
true if the node has child nodes; otherwise, false.

Definition at line 139 of file XmlNode.cs.

◆ LastChild

virtual XmlNode System.Xml.XmlNode.LastChild => LastNode

Gets the last child of the node.

Returns
The last child of the node. If there is no such node, null is returned.

Definition at line 121 of file XmlNode.cs.

◆ NamespaceURI

virtual string System.Xml.XmlNode.NamespaceURI => string.Empty

Gets the namespace URI of this node.

Returns
The namespace URI of this node. If there is no namespace URI, this property returns String.Empty.

Definition at line 143 of file XmlNode.cs.

◆ NextSibling

virtual XmlNode System.Xml.XmlNode.NextSibling => null

Gets the node immediately following this node.

Returns
The next XmlNode. If there is no next node, null is returned.

Definition at line 95 of file XmlNode.cs.

◆ PreviousSibling

virtual XmlNode System.Xml.XmlNode.PreviousSibling => null

Gets the node immediately preceding this node.

Returns
The preceding XmlNode. If there is no preceding node, null is returned.

Definition at line 91 of file XmlNode.cs.

◆ PreviousText

virtual XmlNode System.Xml.XmlNode.PreviousText => null

Gets the text node that immediately precedes this node.

Returns
Returns T:System.Xml.XmlNode.

Definition at line 397 of file XmlNode.cs.

◆ SchemaInfo

virtual IXmlSchemaInfo System.Xml.XmlNode.SchemaInfo => XmlDocument.NotKnownSchemaInfo

Gets the post schema validation infoset that has been assigned to this node as a result of schema validation.

Returns
An T:System.Xml.Schema.IXmlSchemaInfo object containing the post schema validation infoset of this node.

Definition at line 268 of file XmlNode.cs.

Property Documentation

◆ BaseURI

virtual string System.Xml.XmlNode.BaseURI
get

Gets the base URI of the current node.

Returns
The location from which the node was loaded or String.Empty if the node has no base URI.

Definition at line 273 of file XmlNode.cs.

◆ InnerText

virtual string System.Xml.XmlNode.InnerText
getset

Gets or sets the concatenated values of the node and all its child nodes.

Returns
The concatenated values of the node and all its child nodes.

Definition at line 182 of file XmlNode.cs.

◆ InnerXml

virtual string System.Xml.XmlNode.InnerXml
getset

Gets or sets the markup representing only the child nodes of this node.

Returns
The markup of the child nodes of this node. InnerXml does not return default attributes.
Exceptions
T:System.InvalidOperationExceptionSetting this property on a node that cannot have child nodes.
T:System.Xml.XmlExceptionThe XML specified when setting this property is not well-formed.

Definition at line 245 of file XmlNode.cs.

◆ IsReadOnly

virtual bool System.Xml.XmlNode.IsReadOnly
get

Gets a value indicating whether the node is read-only.

Returns
true if the node is read-only; otherwise false.

Definition at line 171 of file XmlNode.cs.

◆ LocalName

abstract string System.Xml.XmlNode.LocalName
get

Gets the local name of the node, when overridden in a derived class.

Returns
The name of the node with the prefix removed. For example, LocalName is book for the element <bk:book>.The name returned is dependent on the P:System.Xml.XmlNode.NodeType of the node: Type Name Attribute The local name of the attribute. CDATA #cdata-section Comment #comment Document #document DocumentFragment #document-fragment DocumentType The document type name. Element The local name of the element. Entity The name of the entity. EntityReference The name of the entity referenced. Notation The notation name. ProcessingInstruction The target of the processing instruction. Text #text Whitespace #whitespace SignificantWhitespace #significant-whitespace XmlDeclaration #xml-declaration

Definition at line 163 of file XmlNode.cs.

◆ Name

abstract string System.Xml.XmlNode.Name
get

Gets the qualified name of the node, when overridden in a derived class.

Returns
The qualified name of the node. The name returned is dependent on the P:System.Xml.XmlNode.NodeType of the node: Type Name Attribute The qualified name of the attribute. CDATA #cdata-section Comment #comment Document #document DocumentFragment #document-fragment DocumentType The document type name. Element The qualified name of the element. Entity The name of the entity. EntityReference The name of the entity referenced. Notation The notation name. ProcessingInstruction The target of the processing instruction. Text #text Whitespace #whitespace SignificantWhitespace #significant-whitespace XmlDeclaration #xml-declaration

Definition at line 20 of file XmlNode.cs.

◆ NodeType

abstract XmlNodeType System.Xml.XmlNode.NodeType
get

Gets the type of the current node, when overridden in a derived class.

Returns
One of the T:System.Xml.XmlNodeType values.

Definition at line 53 of file XmlNode.cs.

◆ OuterXml

virtual string System.Xml.XmlNode.OuterXml
get

Gets the markup containing this node and all its child nodes.

Returns
The markup containing this node and all its child nodes. OuterXml does not return default attributes.

Definition at line 222 of file XmlNode.cs.

◆ OwnerDocument

virtual XmlDocument System.Xml.XmlNode.OwnerDocument
get

Gets the T:System.Xml.XmlDocument to which this node belongs.

Returns
The T:System.Xml.XmlDocument to which this node belongs.If the node is an T:System.Xml.XmlDocument (NodeType equals XmlNodeType.Document), this property returns null.

Definition at line 104 of file XmlNode.cs.

◆ ParentNode

virtual XmlNode System.Xml.XmlNode.ParentNode
get

Gets the parent of this node (for nodes that can have parents).

Returns
The XmlNode that is the parent of the current node. If a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is null. For all other nodes, the value returned depends on the P:System.Xml.XmlNode.NodeType of the node. The following table describes the possible return values for the ParentNode property.NodeType Return Value of ParentNode Attribute, Document, DocumentFragment, Entity, Notation Returns null; these nodes do not have parents. CDATA Returns the element or entity reference containing the CDATA section. Comment Returns the element, entity reference, document type, or document containing the comment. DocumentType Returns the document node. Element Returns the parent node of the element. If the element is the root node in the tree, the parent is the document node. EntityReference Returns the element, attribute, or entity reference containing the entity reference. ProcessingInstruction Returns the document, element, document type, or entity reference containing the processing instruction. Text Returns the parent element, attribute, or entity reference containing the text node.

Definition at line 60 of file XmlNode.cs.

◆ Prefix

virtual string System.Xml.XmlNode.Prefix
getset

Gets or sets the namespace prefix of this node.

Returns
The namespace prefix of this node. For example, Prefix is bk for the element <bk:book>. If there is no prefix, this property returns String.Empty.
Exceptions
T:System.ArgumentExceptionThis node is read-only.
T:System.Xml.XmlExceptionThe specified prefix contains an invalid character.The specified prefix is malformed.The specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace".This node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/ ".This node is an attribute and the qualifiedName of this node is "xmlns".

Definition at line 150 of file XmlNode.cs.

◆ this[string localname, string ns]

virtual XmlElement System.Xml.XmlNode.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.

Parameters
localnameThe local name of the element.
nsThe namespace URI of the element.
Returns
The first T:System.Xml.XmlElement with the matching localname and ns . . It returns a null reference (Nothing in Visual Basic) if there is no match.

Definition at line 327 of file XmlNode.cs.

◆ this[string name]

virtual XmlElement System.Xml.XmlNode.this[string name]
get

Gets the first child element with the specified P:System.Xml.XmlNode.Name.

Parameters
nameThe qualified name of the element to retrieve.
Returns
The first T:System.Xml.XmlElement that matches the specified name. It returns a null reference (Nothing in Visual Basic) if there is no match.

Definition at line 308 of file XmlNode.cs.

◆ Value

virtual string System.Xml.XmlNode.Value
getset

Gets or sets the value of the node.

Returns
The value returned depends on the P:System.Xml.XmlNode.NodeType of the node: Type Value Attribute The value of the attribute. CDATASection The content of the CDATA Section. Comment The content of the comment. Document null. DocumentFragment null. DocumentType null. Element null. You can use the P:System.Xml.XmlElement.InnerText or P:System.Xml.XmlElement.InnerXml properties to access the value of the element node. Entity null. EntityReference null. Notation null. ProcessingInstruction The entire content excluding the target. Text The content of the text node. SignificantWhitespace The white space characters. White space can consist of one or more space characters, carriage returns, line feeds, or tabs. Whitespace The white space characters. White space can consist of one or more space characters, carriage returns, line feeds, or tabs. XmlDeclaration The content of the declaration (that is, everything between <?xml and ?>).
Exceptions
T:System.ArgumentExceptionSetting the value of a node that is read-only.
T:System.InvalidOperationExceptionSetting the value of a node that is not supposed to have a value (for example, an Element node).

Definition at line 36 of file XmlNode.cs.


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