/// <summary> /// Convert the TestOutput object to an XML string /// </summary> public string ToXml() { TNode tnode = new TNode("test-output", Text, true); tnode.AddAttribute("stream", Stream); if (TestName != null) { tnode.AddAttribute("testname", TestName); } return(tnode.OuterXml); }
public string ToXml() { TNode tnode = new TNode("test-message", Message, true); if (Destination != null) { tnode.AddAttribute("destination", Destination); } if (TestId != null) { tnode.AddAttribute("testid", TestId); } return(tnode.OuterXml); }
private static TNode FromXml(XElement xElement) { TNode tNode = new TNode(xElement.Name.ToString(), xElement.Value); foreach (var attr in xElement.Attributes()) { tNode.AddAttribute(attr.Name.ToString(), attr.Value); } foreach (var child in xElement.Elements()) { tNode.ChildNodes.Add(FromXml(child)); } return(tNode); }
private static TNode FromXml(XmlNode xmlNode) { TNode tNode = new TNode(xmlNode.Name, xmlNode.InnerText); foreach (XmlAttribute attr in xmlNode.Attributes) { tNode.AddAttribute(attr.Name, attr.Value); } foreach (XmlNode child in xmlNode.ChildNodes) { if (child.NodeType == XmlNodeType.Element) { tNode.ChildNodes.Add(FromXml(child)); } } return(tNode); }