用XmlWriter编写格式化的XML [英] Writing formatted XML with XmlWriter

查看:127
本文介绍了用XmlWriter编写格式化的XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将XML文件写入隔离存储,但是我想这样格式化它:-

I'm trying to write to an XML file to the isolated storage but I would like to format it like this:-

<SampleData>
  <Item Property1="AliquaXX" />
  <Item Property1="Integer" />
  <Item Property1="Quisque" />
  <Item Property1="Aenean" />
  <Item Property1="Mauris" />
  <Item Property1="Vivamus" />
  <Item Property1="Nullam" />
  <Item Property1="Nam" />
  <Item Property1="Sed" />
  <Item Property1="Class" />
</SampleData>

但是我很困惑,如果我可以解决问题,有人可以帮忙吗?

but I'm buggered if I can work it out, can anyone help?

推荐答案

您可以通过您没有包含任何代码,但是可以在创建XmlWriter时设置XmlWriterSettings.您也可以只使用类似的内容:

You didn't include any code, but you can set the XmlWriterSettings when you create the XmlWriter. You can also just use something like:

var myXmlWriter = new XmlWriterSettings { Indent = true };

这篇关于用XmlWriter编写格式化的XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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