How can I build XML in C#?

前端 未结 9 1665

How can I generate valid XML in C#?

相关标签:
9条回答
  • 2020-11-22 07:03

    For simple cases, I would also suggest looking at XmlOutput a fluent interface for building Xml.

    XmlOutput is great for simple Xml creation with readable and maintainable code, while generating valid Xml. The orginal post has some great examples.

    0 讨论(0)
  • 2020-11-22 07:11

    In the past I have created my XML Schema, then used a tool to generate C# classes which will serialize to that schema. The XML Schema Definition Tool is one example

    http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.71).aspx

    0 讨论(0)
  • 2020-11-22 07:13

    XmlWriter is the fastest way to write good XML. XDocument, XMLDocument and some others works good aswell, but are not optimized for writing XML. If you want to write the XML as fast as possible, you should definitely use XmlWriter.

    0 讨论(0)
提交回复
热议问题