2010. 4. 5. 14:54

XML 개론 - http://msdn.microsoft.com/ko-kr/library/hf9hbf87.aspx

XML 노드 형식 - http://msdn.microsoft.com/ko-kr/library/3k5w5zc3.aspx

XML 데이터에 개체 계층 구조 매핑 - http://msdn.microsoft.com/ko-kr/library/a3bszkbd.aspx

DOM에서 새 노드 만들기 - http://msdn.microsoft.com/ko-kr/library/k44daxya.aspx





간단한 예제

member.xml

<?xml version="1.0" encoding = "UTF-8"?>
<members>
 <id> sjy </id>
 <id> aaa </id>
</members>



ConvertMember.cs

static void Main(string[] args)
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("member.xml");

            XmlElement xe = xdoc.DocumentElement;
            XmlNode xn;

            while ((xn = xe.SelectSingleNode("id")) != null)
            {
                if (xn.Name == "id")
                {
                    XmlElement xne = xdoc.CreateElement("아이디");
                    xne.InnerText = xn.InnerText;

                   
                    xe.RemoveChild(xn);
                    xe.AppendChild(xne);
                }

                Console.WriteLine(xe.InnerXml);   
            }
        }

'.NET > XML.NET' 카테고리의 다른 글

XML기본문법  (0) 2010.04.03
Posted by 아몰라