阅读与学习更新没有根节点的XML文件 [英] Reading & Updating an XML file which has NO ROOT NODE

查看:125
本文介绍了阅读与学习更新没有根节点的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在没有根节点的情况下读取和更新XML文件.

How to read and update an XML file where there is no root node.

推荐答案

将文件读取为文本文件,并使用XElement.Parse()进行解析文本.将代码放入try/catch块中,以防万一您最终无法解析为XML.
Read the file as a text file, and use XElement.Parse() to parse the text. Put the code into a try/catch block just in case you end up parsing something that isn''t identifiable as XML.


我可以理解,但是XML 的第一个规则是
它应该只有一个根节点,

您如何才能分类诸如XML?
I can understand but The first Rule of XML is
It should have one and only one Root node,

How can you categories such as a XML ?


不带根节点,您怎么能说文件是XML.
With Out The Root Node How can u say that the file is XML.


这篇关于阅读与学习更新没有根节点的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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