OuterXml和InnerXml(2)

官方例子:https://msdn.microsoft.com/en-us/library/system.xml.xmlnode.outerxml.aspx

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace outerXML
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml("<Elem><I>woaini</I><NI>ui</NI></Elem>");
            XmlNode root = xmldoc.DocumentElement;
            Console.WriteLine(root.OuterXml);

            Console.WriteLine(root.InnerXml);
            Console.ReadKey();
        }
    }
}

结果:

<Elem><I>woaini</I><NI>ui</NI></Elem>
<I>woaini</I><NI>ui</NI>
posted @ 2017-06-08 15:01  herizai  阅读(369)  评论(0编辑  收藏  举报