Indentation and new line command for XMLwriter in C#

前端 未结 6 807
-上瘾入骨i
-上瘾入骨i 2020-12-09 08:10

I am writing some data to XML file...but when I open it all the values are in a single line...how can write it in readable format?ie each node in new line and indentation?

6条回答
  •  悲&欢浪女
    2020-12-09 08:20

    Check the Settings property:

    w.Settings.Indent = true;
    

    Edit: You can't set it directly:

    System.Xml.XmlWriter.Create("path", new System.Xml.XmlWriterSettings())
    

提交回复
热议问题