AddNode() public méthode

부모 노드에 노드를 추가한다.
public AddNode ( XmlNode parentNode, System.Xml.XmlNodeType nodeType, string name, string text ) : XmlNode
parentNode System.Xml.XmlNode 부모노드
nodeType System.Xml.XmlNodeType System.Xml.XmlNodeType
name string Tag Name
text string Node Value or Text
Résultat System.Xml.XmlNode
Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }