动态XML创建 [英] Dynamic XML creation

查看:74
本文介绍了动态XML创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai,
我是XML的初学者.有人可以告诉我如何在asp.net(C#)中使用StringBuilder创建Dymanic XML吗?

在此先感谢

hai,
I am a beginner in XML.Can anybody tell me that how to create a Dymanic XML with StringBuilder in asp.net(C#)?

Thanks in advance

推荐答案

在这里,您可以看看: XmlWriter.Create方法(StringBuilder,XmlWriterSettings) [ ^ ]
Here you go and look: Google result: Dynamic XML with StringBuilder C#[^]

Start from here: XmlWriter.Create Method (StringBuilder, XmlWriterSettings)[^]


不要用流生成器来做!

您最好使用System.Xml.XmlDataDocument(最简单,适合于不是很大的文档)或System.Xml.Linq.XDocument(显然与LinQ一起使用).

最好使用一次在System.Xml.XmlWriter或派生类之一中创建一个更好的事件,以便在内存中创建自己的动态数据模型并将其最终转换为XML.最后,序列化模型甚至更好.最好的方法是使用数据合同.

—SA
Don''t do it with stream builder!

You should better use System.Xml.XmlDataDocument (the simplest, good for not very big documents) or System.Xml.Linq.XDocument (apparently good to work with LinQ).

Event better to create your own dynamic data model in memory and translate it to XML eventually, at once using System.Xml.XmlWriter or one of the derived classes. Finally, it''s even better to serialize your model; the best way to do this is using Data Contract.

—SA


这篇关于动态XML创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆