更新时间:2023-02-25 18:09:23
.NET FCL提供了不同的XML解析方法。这是我对它们的简短概述:
- 使用
System.Xml.XmlDocument
类。它实现了DOM接口;如果文档的大小不是太大,这种方式是最简单和***的。
参见 http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx 。- 使用类
System.Xml .XmlTextReader
;这是最快的阅读方式,特别是你需要跳过一些数据。
参见 http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx 。- 使用类
System.Xml.Linq .XDocument
;这是类似于XmlDocument
的最合适的方式,支持LINQ to XML Programming。
参见 http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx ,http://msdn.microsoft.com/en-us/library/bb387063.aspx-SA
Dear All
I want to know that how to read xml file in ASP.Net MVC. Please reply .
Regards
.NET FCL offers different method of XML parsing. This is my short overview of them:
- Use
System.Xml.XmlDocument
class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx.- Use the class
System.Xml.XmlTextReader
; this is the fastest way of reading, especially is you need to skip some data.
See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx.- Use the class
System.Xml.Linq.XDocument
; this is the most adequate way similar to that ofXmlDocument
, supporting LINQ to XML Programming.
See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx, http://msdn.microsoft.com/en-us/library/bb387063.aspx
—SA