在xml vb.net中搜索查询 [英] search query in xml vb.net

查看:97
本文介绍了在xml vb.net中搜索查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过vb.net搜索xml中的particualr字段

plsss help



以下是我的xml文件





how to search a particualr field in xml via vb.net
plsss help

below is my xml file


<?xml version="1.0" standalone="yes"?>
<DsXmlDbDemo xmlns="http://tempuri.org/DsXmlDbDemo.xsd">
  <Customers>
    <CustomerId>1</CustomerId>
    <Name>dfgdfg</Name>
    <Address1>dfgdfg</Address1>
    <Address2>dfgdfg</Address2>
    <City>dfgdfgdf</City>
    <St>dfgdfg</St>
    <Zip>45646</Zip>
  </Customers>
  <Customers>
    <CustomerId>2</CustomerId>
    <Name>asfdasd</Name>
    <Address1>sedufsufh</Address1>
    <Address2>sdoifo</Address2>
    <City>efef</City>
    <St>sdfsf</St>
    <Zip>6656</Zip>
  </Customers>
</DsXmlDbDemo>

推荐答案

Omkaara写道:
Omkaara wrote:

我正在使用VS 2005,2.0。 Framework Linq在VS 2005中不可用。

I''am using VS 2005, 2.0. Framework Linq is not available in VS 2005.

如果您不能使用v.2.0以上版本的.NET Framework,则必须使用其他方法处理XML并自行开发搜索。请参阅我的简短概述:



XML读/写:

If you cannot use .NET Framework of the versions above v.2.0, you will have to use other means of working with XML and develop the search by yourself. Please see my short overview:

XML Read/Write:



  1. 使用 System.Xml.XmlDocument class。它实现了DOM接口;如果文档的大小不是太大,这种方式是最简单和最好的。
    参见 http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx [ ^ ]。
  2. 使用类 System.Xml.XmlTextWriter System.Xml.XmlTextReader ;这是最快的阅读方式,特别是你需要跳过一些数据。
    参见 http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx [ ^ ], http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx [ ^ ]。
  3. 仅适用于.NET Framework v.3.5或更高版本:使用类 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 [ ^ ]。

  1. 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[^].
  2. Use the classes System.Xml.XmlTextWriter and 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.xmlwriter.aspx[^], http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Only for .NET Framework v.3.5 or later: Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, 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


请参阅:

http://msdn.microsoft.com/en-us/library/bb387065.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/bb387063.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx [ ^ ]。



-SA
Please see:
http://msdn.microsoft.com/en-us/library/bb387065.aspx[^],
http://msdn.microsoft.com/en-us/library/bb387063.aspx[^],
http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx[^].

—SA


这篇关于在xml vb.net中搜索查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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