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
stringThe name of the node
TNode(string, string)
Constructs a new instance of TNode with a value
public TNode(string name, string value)
Parameters
Properties
Attributes
Gets the dictionary of attributes
public AttributeDictionary Attributes { get; }
Property Value
ChildNodes
Gets a list of child nodes
public NodeList ChildNodes { get; }
Property Value
FirstChild
Gets the first ChildNode
public TNode FirstChild { get; }
Property Value
Name
Gets the name of the node
public string Name { get; }
Property Value
OuterXml
Gets the XML representation of this node.
public string OuterXml { get; }
Property Value
Value
Gets the value of the node
public string Value { get; set; }
Property Value
Methods
AddAttribute(string, string)
Adds an attribute with a specified name and value to the XmlNode.
public void AddAttribute(string name, string value)
Parameters
AddElement(string)
Adds a new element as a child of the current node and returns it.
public TNode AddElement(string name)
Parameters
name
stringThe 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
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
stringThe 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
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
WriteTo(XmlWriter)
Writes the XML representation of the node to an XmlWriter
public void WriteTo(XmlWriter writer)
Parameters
writer
XmlWriter