我的要求如下: 1 =读取xml网址,然后使用文本框搜索特定值,然后按解析顺序列出该文本的所有匹配项
例如:我的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
等
然后使用例如Name = ABCD
的文本框进行搜索,以便此搜索应检查xml
中ABCD的所有出现次数,并列出text box
中与ABCD值相关的完整数据。 1}}
请求帮助
答案 0 :(得分: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