I​Xml​Node I​Xml​Node I​Xml​Node Interface

Definition

Contains information for the entire Document Object Model. This interface represents a single node in the document tree. While all objects that implement this interface expose methods for dealing with children, not all objects that implement this interface may have children.

public : interface IXmlNodepublic interface IXmlNodePublic Interface IXmlNode
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Remarks

Interface inheritance

IXmlNode inherits IXmlNodeSelector and IXmlNodeSerializer. Types that implement IXmlNode also implement the interface members of IXmlNodeSelector and IXmlNodeSerializer.

Properties

Attributes Attributes Attributes

Gets the list of attributes of this node.

public : XmlNamedNodeMap Attributes { get; }public XmlNamedNodeMap Attributes { get; }Public ReadOnly Property Attributes As XmlNamedNodeMap
Value
XmlNamedNodeMap XmlNamedNodeMap XmlNamedNodeMap

The attributes for this node.

Attributes

Remarks

This property returns a XmlNamedNodeMap for the nodes that can return attributes. These are the Element, Entity, and Notation nodes. This property is NULL for all other node types. For the valid node types, the XmlNamedNodeMap is always returned; when there are no attributes on the element, the list length is set to zero.

The following table describes the attributes for the node types.

NodeTypeAttributes
ElementIXmlNamedNodeMap
AttributeNULL
TextNULL
CDATASectionNULL
EntityReferenceNULL
EntityNULL
ProcessingInstructionNULL
CommentNULL
DocumentNULL
DocumentTypeNULL
DocumentFragmentNULL
NotationNULL

ChildNodes ChildNodes ChildNodes

Gets a list of children in the current node.

public : XmlNodeList ChildNodes { get; }public XmlNodeList ChildNodes { get; }Public ReadOnly Property ChildNodes As XmlNodeList
Value
XmlNodeList XmlNodeList XmlNodeList

The list of child nodes.

Attributes

FirstChild FirstChild FirstChild

Gets the first child node.

public : IXmlNode FirstChild { get; }public IXmlNode FirstChild { get; }Public ReadOnly Property FirstChild As IXmlNode
Value
IXmlNode IXmlNode IXmlNode

The first child node. This property returns NULL if there are no children.

Attributes

LastChild LastChild LastChild

Gets the last child node.

public : IXmlNode LastChild { get; }public IXmlNode LastChild { get; }Public ReadOnly Property LastChild As IXmlNode
Value
IXmlNode IXmlNode IXmlNode

The last child node. This property is NULL if there are no children.

Attributes

LocalName LocalName LocalName

Gets the local name, which is the local part of a qualified name. This is called the local part in Namespaces in XML.

public : PlatForm::Object LocalName { get; }public object LocalName { get; }Public ReadOnly Property LocalName As object
Value
PlatForm::Object object object

The local name.

Attributes

NamespaceUri NamespaceUri NamespaceUri

Returns the Uniform Resource Identifier (URI) for the namespace.

public : PlatForm::Object NamespaceUri { get; }public object NamespaceUri { get; }Public ReadOnly Property NamespaceUri As object
Value
PlatForm::Object object object

The Uri for the namespace. This refers to the "uuu" portion of the namespace declaration xmlns:nnn="uuu".

Attributes

NextSibling NextSibling NextSibling

Gets the next sibling of the node in the parent's child list.

public : IXmlNode NextSibling { get; }public IXmlNode NextSibling { get; }Public ReadOnly Property NextSibling As IXmlNode
Value
IXmlNode IXmlNode IXmlNode

The right sibling of this node.

Attributes

NodeName NodeName NodeName

Returns the qualified name for attribute, document type, element, entity, or notation nodes. Returns a fixed string for all other node types.

public : PlatForm::String NodeName { get; }public string NodeName { get; }Public ReadOnly Property NodeName As string
Value
PlatForm::String string string

The qualified node name, which varies depending on the node type.

Attributes

Remarks

This value depends on the NodeType property. The following table describes this dependency.

NodeTypeNodeName
ElementtagName
Attributename of attribute
Text#text
CDATASection#cdata-section
EntityReferencename of entity referenced
Entityentity name
ProcessingInstructiontarget
Comment#comment
Document#document
DocumentTypedocument type name
DocumentFragment#document-fragment
Notationnotation name

NodeType NodeType NodeType

Gets the XML Document Object Model (DOM) node type, which determines valid values and whether the node can have child nodes.

public : NodeType NodeType { get; }public NodeType NodeType { get; }Public ReadOnly Property NodeType As NodeType
Value
NodeType NodeType NodeType

The node type.

Attributes

NodeValue NodeValue NodeValue

Gets or sets the text associated with the node.

public : PlatForm::Object NodeValue { get; set; }public object NodeValue { get; set; }Public ReadWrite Property NodeValue As object
Value
PlatForm::Object object object

The text associated with the node.

Attributes

Remarks

This value depends on the NodeType property. The following table describes this dependency.

NodeTypeNodeValue
ElementNull
AttributeValue of attribute
TextContent of the text node
CDATASectionContent of the CDATA Section
EntityReferenceNULL
EntityNULL
ProcessingInstructionEntire content excluding the target
CommentContent of the comment
DocumentNULL
DocumentTypeNULL
DocumentFragmentNULL
NotationNULL

OwnerDocument OwnerDocument OwnerDocument

Returns the root of the document that contains the node.

public : XmlDocument OwnerDocument { get; }public XmlDocument OwnerDocument { get; }Public ReadOnly Property OwnerDocument As XmlDocument
Value
XmlDocument XmlDocument XmlDocument

The parent document that represents the root of the document.

Attributes

ParentNode ParentNode ParentNode

Gets the parent node of the node instance.

public : IXmlNode ParentNode { get; }public IXmlNode ParentNode { get; }Public ReadOnly Property ParentNode As IXmlNode
Value
IXmlNode IXmlNode IXmlNode

The parent node.

Attributes

Prefix Prefix Prefix

Gets or sets the namespace prefix.

public : PlatForm::Object Prefix { get; set; }public object Prefix { get; set; }Public ReadWrite Property Prefix As object
Value
PlatForm::Object object object

The namespace prefix specified on the element, attribute, or entity reference. For example, for the element <xxx:yyy>, this property returns xxx. It returns an empty string, "", if no prefix is specified.

Attributes

PreviousSibling PreviousSibling PreviousSibling

Gets the previous sibling of the node in the parent's child list.

public : IXmlNode PreviousSibling { get; }public IXmlNode PreviousSibling { get; }Public ReadOnly Property PreviousSibling As IXmlNode
Value
IXmlNode IXmlNode IXmlNode

The left sibling of this node.

Attributes

Methods

AppendChild(IXmlNode) AppendChild(IXmlNode) AppendChild(IXmlNode)

Appends a new child node as the last child of the node.

public : IXmlNode AppendChild(IXmlNode newChild)public IXmlNode AppendChild(IXmlNode newChild)Public Function AppendChild(newChild As IXmlNode) As IXmlNode
Parameters
newChild
IXmlNode IXmlNode IXmlNode

The new child node to be appended to the end of the list of children of this node.

Returns

The new child node successfully appended to the list. If null, no object is created.

Attributes

CloneNode(Boolean) CloneNode(Boolean) CloneNode(Boolean)

Clones a new node.

public : IXmlNode CloneNode(bool deep)public IXmlNode CloneNode(Boolean deep)Public Function CloneNode(deep As Boolean) As IXmlNode
Parameters
deep
bool Boolean Boolean

A flag that indicates whether to recursively clone all nodes that are descendants of this node. If true, this method creates a clone of the complete tree below this node. If false, this method clones this node and its attributes only.

Returns

The newly created clone node.

Attributes

HasChildNodes() HasChildNodes() HasChildNodes()

Determines whether a node has children.

public : PlatForm::Boolean HasChildNodes()public bool HasChildNodes()Public Function HasChildNodes() As bool
Returns
PlatForm::Boolean bool bool

True if this node has children; otherwise false.

Attributes

InsertBefore(IXmlNode, IXmlNode) InsertBefore(IXmlNode, IXmlNode) InsertBefore(IXmlNode, IXmlNode)

Inserts a child node to the left of the specified node, or at the end of the list.

public : IXmlNode InsertBefore(IXmlNode newChild, IXmlNode referenceChild)public IXmlNode InsertBefore(IXmlNode newChild, IXmlNode referenceChild)Public Function InsertBefore(newChild As IXmlNode, referenceChild As IXmlNode) As IXmlNode
Parameters
newChild
IXmlNode IXmlNode IXmlNode

The address of the new node to be inserted. The node passed here must be a valid child of the current XML DOM document node. For example, if the current node is an attribute, you cannot pass another attribute in the newChild parameter, because an attribute cannot have an attribute as a child. If newChild is a DOCUMENT_FRAGMENT node type, all its children are inserted in order before referenceChild.

If newChild is already in the tree, it is first removed before it is reinserted before the referenceChild node. Read-only nodes, such as NODE_DOCUMENT_TYPE and NODE_ENTITY nodes, cannot be passed in the newChild parameter.

referenceChild
IXmlNode IXmlNode IXmlNode

The reference node. The node specified is where the newChild node is to be inserted to the left as the preceding sibling in the child list. The node passed here must be a either a child node of the current node or null. If the value is null, the newChild node is inserted at the end of the child list. If the referenceChild node is not a child of the current node, an error is returned.

Returns

On success, the child node that was inserted. If null, no object is created.

Attributes

Normalize() Normalize() Normalize()

Normalizes all descendant elements by combining two or more adjacent text nodes into one unified text node.

public : void Normalize()public void Normalize()Public Function Normalize() As void
Attributes

RemoveChild(IXmlNode) RemoveChild(IXmlNode) RemoveChild(IXmlNode)

Removes the specified child node from the list of children and returns it.

public : IXmlNode RemoveChild(IXmlNode childNode)public IXmlNode RemoveChild(IXmlNode childNode)Public Function RemoveChild(childNode As IXmlNode) As IXmlNode
Parameters
childNode
IXmlNode IXmlNode IXmlNode

The child node to be removed from the list of children of this node.

Returns

The removed child node. If null, the childNode object is not removed.

Attributes

ReplaceChild(IXmlNode, IXmlNode) ReplaceChild(IXmlNode, IXmlNode) ReplaceChild(IXmlNode, IXmlNode)

Replaces the specified old child node with the supplied new child node.

public : IXmlNode ReplaceChild(IXmlNode newChild, IXmlNode referenceChild)public IXmlNode ReplaceChild(IXmlNode newChild, IXmlNode referenceChild)Public Function ReplaceChild(newChild As IXmlNode, referenceChild As IXmlNode) As IXmlNode
Parameters
newChild
IXmlNode IXmlNode IXmlNode

The new child that is to replace the old child. If null, the referenceChild parameter is removed without a replacement.

referenceChild
IXmlNode IXmlNode IXmlNode

The old child that is to be replaced by the new child.

Returns

The old child that is replaced. If null, no object is created.

Attributes

See Also