AddElementText() public method

XmlElement를 생성하여 부모 노드에 추가한다.
public AddElementText ( XmlNode parentNode, string name, string text ) : XmlElement
parentNode System.Xml.XmlNode
name string Element Tag Name (Element의 TagName은 문자, '_', ':' 만 가능하다.)
text string Element Text Value
return System.Xml.XmlElement
Esempio n. 1
0
        public void AddElementTest() {
            var doc = new XmlDoc("<root/>");
            var child = doc.AddElementText(doc.DocumentElement, "child", "child element text");
            Assert.IsNotNull(child);

            var grandChild = doc.AddElementText(child, "grandChild", "child of child element text");
            Assert.IsNotNull(grandChild);

            Console.WriteLine("Child.OuterXml : " + child.OuterXml);
            Console.WriteLine("Child.InnerXml : " + child.InnerXml);
            Console.WriteLine("Child.InnerText : " + child.InnerText);
        }
Esempio n. 2
0
        public void AddElementTest()
        {
            var doc   = new XmlDoc("<root/>");
            var child = doc.AddElementText(doc.DocumentElement, "child", "child element text");

            Assert.IsNotNull(child);

            var grandChild = doc.AddElementText(child, "grandChild", "child of child element text");

            Assert.IsNotNull(grandChild);

            Console.WriteLine("Child.OuterXml : " + child.OuterXml);
            Console.WriteLine("Child.InnerXml : " + child.InnerXml);
            Console.WriteLine("Child.InnerText : " + child.InnerText);
        }
Esempio n. 3
0
        public void InsertElementTest() {
            var doc = new XmlDoc("<root/>");
            var node = doc.InsertBefore(doc.CreateXmlDeclaration("1.0", "utf-8", ""), doc.DocumentElement);
            Assert.IsNotNull(node);

            var firstElement = doc.AddElementText(doc.DocumentElement, "first", "");
            Assert.IsNotNull(firstElement);

            var second = doc.InsertElementBefore(firstElement, "second", "");
            Assert.IsNotNull(second);
        }
Esempio n. 4
0
        public void InsertElementTest()
        {
            var doc  = new XmlDoc("<root/>");
            var node = doc.InsertBefore(doc.CreateXmlDeclaration("1.0", "utf-8", ""), doc.DocumentElement);

            Assert.IsNotNull(node);

            var firstElement = doc.AddElementText(doc.DocumentElement, "first", "");

            Assert.IsNotNull(firstElement);

            var second = doc.InsertElementBefore(firstElement, "second", "");

            Assert.IsNotNull(second);
        }