Show / Hide Table of Contents

Class XmlNodeExtensions

A static class that contains extension methods for the System.Xml.XmlNode class.

Inheritance
System.Object
XmlNodeExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Juhta.Net.Extensions
Assembly: Juhta.Net.dll
Syntax
public static class XmlNodeExtensions

Methods

| Improve this Doc View Source

AppendChild(XmlNode, String)

Appends a child node to the current node.

Declaration
public static XmlNode AppendChild(this XmlNode node, string childName)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String childName

Specifies a name for the child node.

Returns
Type Description
System.Xml.XmlNode

Returns the appended child node.

| Improve this Doc View Source

AppendChild(XmlNode, String, String)

Appends a child node to the current node.

Declaration
public static XmlNode AppendChild(this XmlNode node, string childName, string childInnerText)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String childName

Specifies a name for the child node.

System.String childInnerText

Specifies an inner text for the child node.

Returns
Type Description
System.Xml.XmlNode

Returns the appended child node.

| Improve this Doc View Source

AppendChild(XmlNode, String, String, String)

Appends a child node to the current node.

Declaration
public static XmlNode AppendChild(this XmlNode node, string qualifiedChildName, string namespaceUri, string innerText)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String qualifiedChildName

Specifies a qualified name for the child node.

System.String namespaceUri

Specifies a namespace URI for the child node.

System.String innerText

Specifies an inner text for the child node. Can be null.

Returns
Type Description
System.Xml.XmlNode

Returns the appended child node.

| Improve this Doc View Source

AppendChild(XmlNode, String, String, String[], String[])

Appends a child node to the current node.

Declaration
public static XmlNode AppendChild(this XmlNode node, string childName, string childInnerText, string[] attributeNames, string[] attributeValues)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String childName

Specifies a name for the child node.

System.String childInnerText

Specifies an inner text for the child node. Can be null.

System.String[] attributeNames

A string array specifying names for the attributes to be added to the child node. Can be null.

System.String[] attributeValues

A string array specifying values for the attributes to be added to the child node. This parameter will be ignored if attributeNames is null.

Returns
Type Description
System.Xml.XmlNode

Returns the appended child node.

Remarks

The lengths of the arrays attributeNames and attributeValues must match.

| Improve this Doc View Source

CopyTo(XmlNode, XmlNode)

Copies the current node to another node.

Declaration
public static void CopyTo(this XmlNode node, XmlNode destination)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.Xml.XmlNode destination

Specifies a destination node.

Remarks

Copying covers all attributes and child nodes.

| Improve this Doc View Source

GetAttribute(XmlNode, String)

Gets an attribute value from the current node.

Declaration
public static string GetAttribute(this XmlNode node, string name)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String name

Specifies an attribute name.

Returns
Type Description
System.String

Returns the value of the specified attribute or an empty string, if the attribute wasn't found.

| Improve this Doc View Source

GetAttribute(XmlNode, String, String)

Gets an attribute value from the current node.

Declaration
public static string GetAttribute(this XmlNode node, string name, string defaultValue)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String name

Specifies an attribute name.

System.String defaultValue

Specifies a default value for the attribute.

Returns
Type Description
System.String

Returns the value of the specified attribute or the default value, if the attribute wasn't found.

| Improve this Doc View Source

HasAttribute(XmlNode, String)

Checks whether the current node has a specified attribute.

Declaration
public static bool HasAttribute(this XmlNode node, string name)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String name

Specifies an attribute name.

Returns
Type Description
System.Boolean

Returns true if the current node has the specified attribute, otherwise false.

| Improve this Doc View Source

SetAttribute(XmlNode, String, String)

Sets an attribute to the current node.

Declaration
public static void SetAttribute(this XmlNode node, string name, string value)
Parameters
Type Name Description
System.Xml.XmlNode node

Specifies the current node.

System.String name

Specifies a name for the attribute to be set.

System.String value

Specifies a value for the attribute to be set.

Remarks

If the attribute already exists the function just updates its value.

  • Improve this Doc
  • View Source
Back to top Copyright © 2017-2019 Juha Lähteenmäki
Generated by DocFX