在vb.net中读取复杂的xml [英] reading complex xml in vb.net
问题描述
我的xml文档顺序不正确,因此无法使用数据集.
我想读取标签,但标签在其他4个地方重复使用不同的值
例如说:
<给定名称>是一个标签,它出现在4个位置,此给定名称的根标签也不同.但是,根标签中包含的值太多.因此请根据我的意愿帮助我阅读xml.
请给我一些阅读资料,可能是阅读xml的基础.希望对我有帮助
在此先感谢
问候
siv
i ve a xml document which is not in correct order so cant able to use dataset.
i want to read a tag but the tag is repeating in 4 other places with diffrent values
say for eg:
<given name> is a tag and it occurs in 4 place the root tag for this given name is also different.but root tag has so many values in it. so help me out to read xml according to my wish.
kindly suggest me some readings might be basics to read xml. i hope that will be helpful for me
thanks in advance
regards
siv
推荐答案
问题现在还不太清楚.请参阅我对这个问题的评论.
也许您只需要LINQ to XML编程?然后您可以使用System.Xml.Linq.XDocument
;请参阅下面.但是,如果确实需要这样做,则无论使用哪种方法,都可以始终使用XML中的任何顺序.请参阅我对基于标准.NET库的方法的概述:
The question is not quite clear right now. Please see my comment to the question.
Perhaps all you want is LINQ to XML programming? Then you can useSystem.Xml.Linq.XDocument
; please see below. However, you can always work with any order in XML if this is really needed, no matter what approach you use. Please see my overview of the approaches based on standard .NET libraries:
- 使用
System.Xml.XmlDocument
类.它实现了DOM接口;如果文档太大,则这种方法最简单,也足够好.
请参见- 使用类
].System.Xml.XmlTextReader
; library/system.xml.xmldocument.aspx"target =" _ blank"title =" New Window> ^ - 使用类
- 使用类
System.Xml.XmlTextReader
;这是最快的读取方法,尤其是您需要跳过一些数据.
请参见 http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx [ 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[^].
祝你好运,
Good luck,
这篇关于在vb.net中读取复杂的xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!