2024 April Release

Interface XmlNode Permanent link for this heading

This interface describes methods and properties available to work with xml nodes.

Methods Permanent link for this heading

Return Type

Signature

XmlNode

AppendChild(
  XmlNode newChild)

string

GetAttribute(
  string name)

XmlNode

GetAttributeNode(
  string name)

void

GetAttributeNS(
  string namespaceURI,
  string localName)

string

GetXML()

boolean

HasAttributes()

boolean

HasChildNodes()

XmlNode

InsertBefore(
  XmlNode newChild,
  XmlNode refChild)

XmlNodeList

Query(
  string xpath)

void

RemoveAttribute(
  string name)

void

RemoveAttributeNS(
  string namespaceURI,
  string localName)

XmlNode

RemoveChild(
  XmlNode oldChild)

XmlNode

ReplaceChild(
  XmlNode newChild,
  XmlNode oldChild)

void

SetAttribute(
  string name,
  string value)

void

SetAttributeNS(
  string namespaceURI,
  string qualifiedName,
  string value)

Properties Permanent link for this heading

Type

Property

XmlNodeList

attributes

XmlNodeList

childnodes

XmlNode

firstchild

XmlNode

lastchild

string

namespaceuri

XmlNode

nextsibling

string

nodename

integer

nodetype

string

nodevalue

XmlDocument

ownerdocument

XmlNode

parentnode

string

prefix

XmlNode

previoussibling

string

textcontent

Methods Permanent link for this heading


AppendChild Permanent link for this heading

Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

XmlNode AppendChild(
  XmlNode newChild)

Name

Description

newChild

The node to add.

GetAttribute Permanent link for this heading

Retrieves an attribute value by name.
To retrieve an attribute value with a qualified name and namespace URI, use the getAttributeNS method.

string GetAttribute(
  string name)

Name

Description

name

The name of the attribute to retrieve.

GetAttributeNode Permanent link for this heading

Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI, use the GetAttributeNodeNS method.

XmlNode GetAttributeNode(
  string name)

Name

Description

name

The nodeName of the attribute to retrieve.

GetAttributeNS Permanent link for this heading

Retrieves an attribute value by local name and namespace URI.

void GetAttributeNS(
  string namespaceURI,
  string localName)

Name

Description

namespaceURI

The namespace URI of the attribute to retrieve.

localName

The qualified name of the attribute to retrieve.

GetXML Permanent link for this heading

Returns the XML representation of the XmlNode.

string GetXML()


HasAttributes Permanent link for this heading

Returns whether this node (if it is an element) has any attributes.

boolean HasAttributes()


HasChildNodes Permanent link for this heading

Returns whether this node has any children.

boolean HasChildNodes()


InsertBefore Permanent link for this heading

Inserts the node newChild before the existing child node refChild and returns it. If refChild is null, insert newChild at the end of the list of children.
If the newChild is already in the tree, it is first removed.

XmlNode InsertBefore(
  XmlNode newChild,
  XmlNode refChild)

Name

Description

newChild

The node to insert.

refChild

The reference node, i.e., the node before which the new node must be inserted.

Query Permanent link for this heading

Returns an XmlNodeList of all the XmlNodes matching a given XPath and contained in the node.

XmlNodeList Query(
  string xpath)

Name

Description

xpath

The XPath which is evaluated to get the XmlNodes.

RemoveAttribute Permanent link for this heading

Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable.
If no attribute with this name is found, this method has no effect.
To remove an attribute by local name and namespace URI, use the RemoveAttributeNS method.

void RemoveAttribute(
  string name)

Name

Description

name

The name of the attribute to remove.

RemoveAttributeNS Permanent link for this heading

Removes an attribute by local name and namespace URI. If no attribute with this local name and namespace URI is found,this method has no effect.

void RemoveAttributeNS(
  string namespaceURI,
  string localName)

Name

Description

namespaceURI

The namespace URI of the attribute to retrieve.

localName

The local name of the attribute to retrieve.

RemoveChild Permanent link for this heading

Removes the child node indicated by oldChild from the list of children, and returns it.

XmlNode RemoveChild(
  XmlNode oldChild)

Name

Description

oldChild

The node being removed.

ReplaceChild Permanent link for this heading

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If the newChild is already in the tree, it is first removed.

XmlNode ReplaceChild(
  XmlNode newChild,
  XmlNode oldChild)

Name

Description

newChild

The new node to put in the child list.

oldChild

The node being replaced in the list.

SetAttribute Permanent link for this heading

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity.
To set an attribute with a qualified name and namespace URI, use the SetAttributeNS method.

void SetAttribute(
  string name,
  string value)

Name

Description

name

The name of the attribute to create or alter.

value

Value to set in string form.

SetAttributeNS Permanent link for this heading

Adds a new attribute with a namespace and a prefix. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity.

void SetAttributeNS(
  string namespaceURI,
  string qualifiedName,
  string value)

Name

Description

namespaceURI

The namespace URI of the attribute to set.

qualifiedName

The qualified name of the attribute to set.

value

Value to set in string form.

Properties Permanent link for this heading


attributes Permanent link for this heading

An XmlNodeList containing the attributes of this node or null otherwise.

XmlNodeList attributes readonly


childnodes Permanent link for this heading

An XmlNodeList that contains all children of this node. If there are no children, this is an XmlNodeList containing no nodes.

XmlNodeList childnodes readonly


firstchild Permanent link for this heading

The first child of this node. If there is no such node, this returns null

XmlNode firstchild readonly


lastchild Permanent link for this heading

The last child of this node. If there is no such node, this returns null.

XmlNode lastchild readonly


namespaceuri Permanent link for this heading

The namespace URI of this node, or null if it is unspecified (see ).
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

string namespaceuri readonly


nextsibling Permanent link for this heading

The node immediately following this node. If there is no such node, this returns null.

XmlNode nextsibling readonly


nodename Permanent link for this heading

The name of this node.

string nodename readonly


nodetype Permanent link for this heading

A code representing the type of the underlying object.

integer nodetype


nodevalue Permanent link for this heading

The value of this node.

string nodevalue


ownerdocument Permanent link for this heading

The XmlDocument owning the node.

XmlDocument ownerdocument readonly


parentnode Permanent link for this heading

The parent of this node. If a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.

XmlNode parentnode readonly


prefix Permanent link for this heading

The namespace prefix of this node, or null if it is unspecified.

string prefix readonly


previoussibling Permanent link for this heading

The node immediately preceding this node. If there is no such node, this returns null.

XmlNode previoussibling readonly


textcontent Permanent link for this heading

This attribute returns the text content of this node and its descendants.

string textcontent