VB循环读取XML子节点问题
<Coder Table="AIRLINENUMBER">
<T><C>495</C><D>CARGO MANAGEMENT</D></T>
<T><C>779</C><D>DARWIN AIRLINE SA LUGANO</D></T>
<T><C>987</C><D>US TIPS</D></T>
<T><C>840</C><D>PALAU ASIA PACIFIC AIR</D></T>
<T><C>791</C><D>WEST CARIBBEAN COSTARICA</D></T>
<T><C>790</C><D>AMADEUS</D></T>
</Coder>
xml文件是上面的,怎么根据C标签里的内容拿出D标签里的内容?? 循环读取怎么处理啊? 我是刚接触VB所以麻烦大家了,讲得详细一点点咯! 谢谢
[解决办法]
定义一个ds as dataset .
一口气ds.ReadXml(sFileName)
[解决办法]
dim C as string = "495"dim xml as new xmldocmentxml.load("fileName.xml")dim nodelist_T as xmlnodelist = xml.GetElementsByTagName("T")for i as integer = 0 to nodelist_T.count-1 dim strC as string = nodelist_T(i).item("C").innerText if strC= C Then dim strD as string = nodelist_T(i).item("D").innerText console.WriteLine("D is:" & strD) end ifnext