using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;using System.Xml;
namespace CH11
{
class p575_NewDOM
{
static void Main()
{
XmlDocument xDoc = new XmlDocument();XmlElement eBookList = xDoc.CreateElement("booklist");
xDoc.AppendChild(eBookList);XmlElement eBook = xDoc.CreateElement("book");
XmlElement eTitle = xDoc.CreateElement("title");
XmlText txtTitle = xDoc.CreateTextNode("XML Programming with .NET");eTitle.AppendChild(txtTitle);
eBook.AppendChild(eTitle);eBook.SetAttribute("id", "b10");
eBook.SetAttribute("kind", "컴퓨터");
eBookList.AppendChild(eBook);xDoc.Save(@"..\..\booklist2.xml");
}
}
}
ref. .NET 개발자를 XML p.575
댓글 영역