public AddNode ( |
||
parentNode | 부모노드 | |
nodeType | System.Xml.XmlNodeType | System.Xml.XmlNodeType |
name | string | Tag Name |
text | string | Node Value or Text |
Результат |
public void AddNodeTest() { var doc = new XmlDoc("<root/>"); Assert.IsTrue(XmlTool.IsValidDocument(doc)); var element = doc.AddNode(doc.DocumentElement, XmlNodeType.Element, "Element", "ElementText"); Assert.IsNotNull(element); Assert.AreEqual("Element", element.Name); // XmlComment 노드는 var comment = doc.AddNode(element, XmlNodeType.Comment, string.Empty, "CommentsText"); Assert.AreEqual("#comment", comment.Name); Assert.AreEqual("CommentsText", comment.Value); }
public void AddNodeTest() { var doc = new XmlDoc("<root/>"); Assert.IsTrue(XmlTool.IsValidDocument(doc)); var element = doc.AddNode(doc.DocumentElement, XmlNodeType.Element, "Element", "ElementText"); Assert.IsNotNull(element); Assert.AreEqual("Element", element.Name); // XmlComment 노드는 var comment = doc.AddNode(element, XmlNodeType.Comment, string.Empty, "CommentsText"); Assert.AreEqual("#comment", comment.Name); Assert.AreEqual("CommentsText", comment.Value); }