本文介绍了XML数据直线排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
WebServiceOutput wso = new WebServiceOutput();
BinaryWriter binWriter = new BinaryWriter(File.Open(@C:\ DAF\config\xyz.xml,FileMode.Create, FileAccess.Write));
binWriter.Write(HierarchyFileContent);
binWriter.Close();
让我知道,当我尝试使用FileMode.Create创建新的xml文件时。文件将保存在一行中,而不是相应的。
WebServiceOutput wso = new WebServiceOutput();
BinaryWriter binWriter = new BinaryWriter(File.Open(@"C:\DAF\config\xyz.xml", FileMode.Create, FileAccess.Write));
binWriter.Write(HierarchyFileContent);
binWriter.Close();
Let me know, When i am trying to create new xml file using "FileMode.Create". File will be saved in a single line not in appropriate from.
推荐答案
WebServiceOutput wso = new WebServiceOutput();
BinaryWriter binWriter = new BinaryWriter(File.Open(@"C:\DAF\config\xyz.xml", FileMode.Create, FileAccess.Write));
// Prettify (indent) 'HierarchyFileContent' content.
binWriter.Write(XDocument.Parse(HierarchyFileContent).ToString());
binWriter.Close();
这篇关于XML数据直线排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!