查询XML文件当中是否有该节点
<?xml version= "1.0 " encoding= "gb2312 " ?>
- <CRS.CommandSet.PNR>
- <PNRs>
<PNR No= "55610 " GDS= "AO " />
<PNR No= "DJENB " GDS= "CA " />
</PNRs>
<RMKs />
- <FNs ElementNo= "10 " PsgID= "0 ">
<FN Type= "F " Currency= "CNY " Value= "320.00 " ExtType= " " />
<FN Type= "S " Currency= "CNY " Value= "320.00 " ExtType= " " />
<FN Type= "C " Currency= " " Value= "3.00 " ExtType= " " />
<FN Type= "X " Currency= "CNY " Value= "100.00 " ExtType= " " />
<FN Type= "T " Currency= "CNY " Value= "50.00 " ExtType= "CN " />
<FN Type= "T " Currency= "CNY " Value= "50.00 " ExtType= "YQ " />
<FN Type= "A " Currency= "CNY " Value= "420.00 " ExtType= " " />
</FNs>
</CRS.CommandSet.PNR>
我想对上面这一段XML进行查询。。想知道有没有 PNRs 这个节点要怎么查。。还有 PNRs 该节点下有没有参数的值。。在线等。。。急。。
------解决方案--------------------Set oDoc = CreateObject( "Msxml2.DOMDocument ")
oDoc.async = False
oDoc.Load sFile
Set oNode = oDoc.selectSingleNode( "//PNRs ")
If oNode Is Nothing Then
没有 PNRs
Else
Sey oSubNode = oNode.selectSingleNode( "PNR ")
If oSubNode Is Nothing Then
没有 PNR
End If
End If