Linq to xml: XDocument对象
2008-12-26 10:37
441 查看
XDocument d = new XDocument(
new XComment("This is a comment."),
new XProcessingInstruction("xml-stylesheet",
"href='mystyle.css' title='Compact' type='text/css'"),
new XElement("Pubs",
new XElement("Book",
new XElement("Title", "Artifacts of Roman Civilization"),
new XElement("Author", "Moreno, Jordao")
),
new XElement("Book",
new XElement("Title", "Midieval Tools and Implements"),
new XElement("Author", "Gazit, Inbar")
)
),
new XComment("This is another comment.")
);
d.Declaration = new XDeclaration("1.0", "utf-8", "true");
Console.WriteLine(d);
d.Save("c:/test.xml");
new XComment("This is a comment."),
new XProcessingInstruction("xml-stylesheet",
"href='mystyle.css' title='Compact' type='text/css'"),
new XElement("Pubs",
new XElement("Book",
new XElement("Title", "Artifacts of Roman Civilization"),
new XElement("Author", "Moreno, Jordao")
),
new XElement("Book",
new XElement("Title", "Midieval Tools and Implements"),
new XElement("Author", "Gazit, Inbar")
)
),
new XComment("This is another comment.")
);
d.Declaration = new XDeclaration("1.0", "utf-8", "true");
Console.WriteLine(d);
d.Save("c:/test.xml");
相关文章推荐
- Linq to xml:XName 对象的预原子化
- Linq to xml:XAttribute对象
- 原子化 XName 和 XNamespace 对象 (LINQ to XML)
- 为什么LINQ to XML的性能要优于XmlDocument?
- LinQ To XML——LinQ To XML .Net3.5中的新Xml对象
- XmlDocument和LINQ to XML两种方式对xml的创建、查询
- LINQ to XML .Net 3.5 中的新XML对象
- LINQ To XML:按文档定义的元素顺序显示元素InDocumentOrder
- LinqToXML中的XmlDocument去除头部声明写法
- Linq To Xml 备忘录1(XDocument, XElement的使用)
- LINQ to XML .Net 3.5 中的新XML对象
- c#操作xml文件(XmlDocument,XmlTextReader,Linq To Xml)
- 为什么LINQ to XML的性能要优于XmlDocument?
- LINQ to XML .Net 3.5 中的新XML对象
- Linq To XML把对象数组写入xml
- XML 搜索和验证(XmlDocument、XPath to XmlDocument、LINQ to XDocument)
- linq to xml
- Linq To Xml
- Delphi 中的 XMLDocument 类详解(20) - 动态建立 XMLDocument 对象
- LINQ to XML