XmlDocument [英] XmlDocument
本文介绍了XmlDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用此XmlDocument输出带有某些参数(例如速度加速度方向等)的xml文件.
我使用create textnode和create element函数,但是我发现如果需要输出更多参数是很麻烦的,因为我需要追加textnode n元素....
anywhey创建节点并同时设置其持有的内容吗?
例如
node(nodename)-> value(它拥有的值);
using this XmlDocument to ouput a xml file with some parameters like velocity acceleration direction etc....
i using the create textnode and create element function but i found it was troublesome if i need to output more parameters as i need to appendchild the textnode n element ....
anywhey to create the node and at the same time set the content it holds??
for example
node(nodename)->value(value it holds);
推荐答案
看看XmlSerializer类 [
Have a look at the XmlSerializer Class[^].
It could help you writing and reading XML files: it automatically serialize/deserialize all thepublic
fields and properties of anyclass
orstruct
using reflection to iterate on them and create the pairs name/value.
这篇关于XmlDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文