本文整理汇总了C#中XmlNode.AddElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.AddElement方法的具体用法?C# XmlNode.AddElement怎么用?C# XmlNode.AddElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNode
的用法示例。
在下文中一共展示了XmlNode.AddElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToXml
/// <summary>
/// Returns an XmlNode representing the current result after
/// adding it as a child of the supplied parent node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="recursive">If true, descendant results are included</param>
/// <returns></returns>
public override XmlNode AddToXml(XmlNode parentNode, bool recursive)
{
XmlNode thisNode = parentNode.AddElement(XmlElementName);
PopulateTestNode(thisNode, recursive);
thisNode.AddAttribute("seed", this.Seed.ToString());
return thisNode;
}
示例2: AddToXml
/// <summary>
/// Returns an XmlNode representing the PropertyBag after
/// adding it as a child of the supplied parent node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="recursive">Not used</param>
/// <returns></returns>
public XmlNode AddToXml(XmlNode parentNode, bool recursive)
{
XmlNode properties = parentNode.AddElement("properties");
foreach (string key in Keys)
{
foreach (object value in this[key])
{
XmlNode prop = properties.AddElement("property");
// TODO: Format as string
prop.AddAttribute("name", key.ToString());
prop.AddAttribute("value", value.ToString());
}
}
return properties;
}
示例3: AddToXml
/// <summary>
/// Returns an XmlNode representing the current result after
/// adding it as a child of the supplied parent node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="recursive">If true, descendant results are included</param>
/// <returns></returns>
public override XmlNode AddToXml(XmlNode parentNode, bool recursive)
{
XmlNode thisNode = parentNode.AddElement("test-suite");
thisNode.AddAttribute("type", this.TestType);
PopulateTestNode(thisNode, recursive);
thisNode.AddAttribute("testcasecount", this.TestCaseCount.ToString());
if (recursive)
foreach (Test test in this.Tests)
test.AddToXml(thisNode, recursive);
return thisNode;
}
示例4: AddOutputElement
private XmlNode AddOutputElement(XmlNode targetNode)
{
XmlNode outputNode = targetNode.AddElement("output");
outputNode.TextContent = this.Output;
return outputNode;
}
示例5: AddFailureElement
/// <summary>
/// Adds a failure element to a node and returns it.
/// </summary>
/// <param name="targetNode">The target node.</param>
/// <returns>The new failure element.</returns>
private XmlNode AddFailureElement(XmlNode targetNode)
{
XmlNode failureNode = targetNode.AddElement("failure");
if (this.Message != null)
{
failureNode.AddElement("message").TextContent = this.Message;
}
if (this.StackTrace != null)
{
failureNode.AddElement("stack-trace").TextContent = this.StackTrace;
}
return failureNode;
}
示例6: AddReasonElement
/// <summary>
/// Adds a reason element to a node and returns it.
/// </summary>
/// <param name="targetNode">The target node.</param>
/// <returns>The new reason element.</returns>
private XmlNode AddReasonElement(XmlNode targetNode)
{
XmlNode reasonNode = targetNode.AddElement("reason");
reasonNode.AddElement("message").TextContent = this.Message;
return reasonNode;
}
示例7: AddToXml
/// <summary>
/// Returns an XmlNode representing the current object after
/// adding it as a child of the supplied parent node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="recursive">If true, children are included, where applicable</param>
/// <returns></returns>
public XmlNode AddToXml(XmlNode parentNode, bool recursive)
{
XmlNode thisNode = parentNode.AddElement("output");
thisNode.AddAttribute("type", this.Type.ToString());
thisNode.AddAttribute("text", this.Text);
return thisNode;
}