Table of Contents

Class XmlNode

Namespace
NUnit.Framework.Interfaces
Assembly
nunit.framework.dll

XmlNode represents a single node in the XML representation of a Test or TestResult. It replaces System.Xml.XmlNode and provides a minimal set of methods for operating on the XML in a platform-independent manner.

public class XmlNode
Inheritance
XmlNode
Inherited Members

Constructors

XmlNode(string)

Constructs a new instance of XmlNode

public XmlNode(string name)

Parameters

name string

The name of the node

Properties

Attributes

Gets the dictionary of attributes

public AttributeDictionary Attributes { get; }

Property Value

AttributeDictionary

ChildNodes

Gets a list of child nodes

public NodeList ChildNodes { get; }

Property Value

NodeList

EscapedTextContent

Gets the text content of the node escaped as needed. This is for use in writing out the XML representation.

public string EscapedTextContent { get; }

Property Value

string

FirstChild

Gets the first child of this node, or null

public XmlNode FirstChild { get; }

Property Value

XmlNode

Name

Gets the name of the node

public string Name { get; }

Property Value

string

OuterXml

Gets the outer XML.

public string OuterXml { get; }

Property Value

string

The outer XML.

TextContent

Gets the text content of the node

public string TextContent { get; set; }

Property Value

string

Methods

AddAttribute(string, string)

Adds an attribute with a specified name and value to the XmlNode.

public void AddAttribute(string name, string value)

Parameters

name string

The name of the attribute.

value string

The value of the attribute.

AddElement(string)

Adds a new element as a child of the current node and returns it.

public XmlNode AddElement(string name)

Parameters

name string

The element name.

Returns

XmlNode

The newly created child element

CreateTopLevelElement(string)

Creates a new top level element node.

public static XmlNode CreateTopLevelElement(string name)

Parameters

name string

The element name.

Returns

XmlNode

FindDescendant(string)

Finds a single descendant of this node matching an xpath specification. The format of the specification is limited to what is needed by NUnit and its tests.

public XmlNode FindDescendant(string xpath)

Parameters

xpath string

Returns

XmlNode

FindDescendants(string)

Finds all descendants of this node matching an xpath specification. The format of the specification is limited to what is needed by NUnit and its tests.

public NodeList FindDescendants(string xpath)

Parameters

xpath string

Returns

NodeList

WriteTo(XmlWriter)

Writes the XML representation of the node to an XmlWriter

public void WriteTo(XmlWriter writer)

Parameters

writer XmlWriter