2

我的要求如下: 1 = 读取 xml url,然后使用文本框搜索特定值,然后按解析顺序列出该文本的所有出现

例如:我的 API 如下:

<Record1>
<ID>4</ID>
<Name>ABCD</Name>
<NumberOfPosition>1</NumberOfPosition>
<Rate>0</Rate>
<SignalID>102288301</SignalID>
<SignalTime>2013-07-16T23:59:59.043</SignalTime>
<SignalType>CloseMarketOrder</SignalType>
<Loss>0</Loss>
<SubName>78730843</SubName>
<SystemID>720</SystemID>
<SystemName>Passion 1</SystemName>
<Profitrate>0</Profitrate>
</Record1>

<pre lang="HTML"><blockquote class="FQ"><div class="FQA">Quote:</div><Record2>
<ID>4</ID>
<Name>ABCD</Name>
<NumberOfPosition>1</NumberOfPosition>
<Rate>0</Rate>
<SignalID>102288301</SignalID>
<SignalTime>2013-07-16T23:59:59.043</SignalTime>
<SignalType>CloseMarketOrder</SignalType>
<Loss>0</Loss>
<SubName>78730843</SubName>
<SystemID>720</SystemID>
<SystemName>Passion 1</SystemName>
<Profitrate>0</Profitrate>
</Record2>

等等

我想像这样解析它:

ID = 4
Name = ABCD

ETC

然后使用文本框搜索例如:Name = ABCD因此此搜索应检查 ABCD 中的所有出现xml并列出与 ABCD 值相关的完整数据text box

请帮忙

4

1 回答 1

0

代码对我来说是这样的。看看能不能帮到你。:-)

    dim strID as string = '1' ''Your ID 
    Dim xmlDoc As New XmlDocument

    xmlDoc.Load(PATH) 'Load Xml here

    For Each node As XmlNode In xmlDoc.ChildNodes
       for each subNode as XmlNode in node
          if sunNode.innerText = strID then
             'get all the sub node details
             'Exit both the for loops

          End If
       next
    Next
于 2013-07-18T09:33:14.477 回答