在vb中解析XML文件 [英] Parsing XML file in vb
本文介绍了在vb中解析XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
你能帮我读一下使用vb.net的XML文件
我的XML文件如下:
hi
could you help me reading XML file using vb.net
my XML file looks like :
<This is SAHR Document created on:>
07/05/2013 01:41:25 ص
<Dots>
<New_Dot>
<X_coordinate>59</X_coordinate>
<Y_coordinate>61</Y_coordinate>
<layer>0</layer>
</New_Dot>
</Dots>
< br / >
i希望在变量中检索X_coordinate的值,因此Y_coordinate和layer
的值如果有任何想法请帮助。
i want to retrive the value of X_coordinate in a variable and so the value of Y_coordinate and layer
if any one has an idea please help .
推荐答案
您拥有.NET FCL所需的一切。这是我对解析XML的方法的简短概述:
You have everything you need in .NET FCL. This is my short overview of the ways to parse XML:
- 使用
系统.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 [ ^ ]。
- 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[^].
这篇关于在vb中解析XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文