28,391
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="gb2312"?>
<LIST>
<data>
<ID>1</ID>
<NAME>法国</NAME>
</data>
<data>
<ID>2</ID>
<NAME>意大利</NAME>
</data>
<data>
<ID>3</ID>
<NAME>英国</NAME>
</data>
<data>
<ID>4</ID>
<NAME>日本</NAME>
</data>
<data>
<ID>5</ID>
<NAME>美国</NAME>
</data>
<data>
<ID>6</ID>
<NAME>德国</NAME>
</data>
</LIST>
sXML = "<LIST>" &_
" <data>" &_
" <ID>1</ID>" &_
" <NAME>法国</NAME>" &_
" </data>" &_
" <data>" &_
" <ID>2</ID>" &_
" <NAME>意大利</NAME>" &_
" </data>" &_
"</LIST>"
ID = "2"
Set oDoc = CreateObject("Msxml2.DOMDocument")
With oDoc
.async = False
.validateOnParse = False
.preserveWhiteSpace = False
.resolveExternals = False
.loadXML sXML
If .parseError.errorCode <> 0 Then
sErrMsg = .parseError.errorCode & "|" &_
.parseError.srcText & "|" & .parseError.reason
Response.Write sErrMsg
Response.End
End If
Set oNode = .selectSingleNode("//data[./ID/text()=" & ID & "]/NAME")
Response.Write oNode.text
Set oNode = Nothing
End With
Set oDoc = Nothing