Table of Contents

Class TNode

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

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

public class TNode
Inheritance
TNode
Inherited Members

Constructors

TNode(string)

Constructs a new instance of TNode

public TNode(string name)

Parameters

name string

The name of the node

TNode(string, string)

Constructs a new instance of TNode with a value

public TNode(string name, string value)

Parameters

name string

The name of the node

value string

The text content 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

FirstChild

Gets the first ChildNode

public TNode FirstChild { get; }

Property Value

TNode

Name

Gets the name of the node

public string Name { get; }

Property Value

string

OuterXml

Gets the XML representation of this node.

public string OuterXml { get; }

Property Value

string

Value

Gets the value of the node

public string Value { 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 TNode AddElement(string name)

Parameters

name string

The element name.

Returns

TNode

The newly created child element

AddElement(string, string)

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

public TNode AddElement(string name, string value)

Parameters

name string

The element name

value string

The text content of the new element

Returns

TNode

The newly created child element

FromXml(string)

Create a TNode from it's XML text representation

public static TNode FromXml(string xmlText)

Parameters

xmlText string

The XML text to be parsed

Returns

TNode

A TNode

SelectNodes(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 SelectNodes(string xpath)

Parameters

xpath string

Returns

NodeList

SelectSingleNode(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 TNode SelectSingleNode(string xpath)

Parameters

xpath string

Returns

TNode

WriteTo(XmlWriter)

Writes the XML representation of the node to an XmlWriter

public void WriteTo(XmlWriter writer)

Parameters

writer XmlWriter