我的经典ASP代码连接到一个URL,并显示XML,我的代码看起来像下面阅读嵌套节点
Response.ContentType = "text/xml"
myRSSfile = "http://abc.com"
Set getPage = Server.CreateObject("Microsoft.XMLHTTP")
getPage.Open "GET", myRSSfile, false
getPage.SetRequestHeader "Content-type", "text/xml"
getPage.Send
Response.Write(getPage.responseText)
'response.write getPage.Status
Set getPage = Nothing
XML如下
<userContent xmlns="http://www.abc.com/userContent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.abc.com/abc.xsd">
<questions>
<question>
<item>
<sku>SCG20056-006</sku>
<title>Test me machine</title>
</item>
<text>
We are replacing a built in machine how it would be ?
</text>
<dateTime>2011-11-10T22:43:02Z</dateTime>
<answer>
<user>
<firstName>Raj</firstName>
<lastName>lastname</lastName>
</user>
<text>
We have been very happpy with the replacement
</text>
<dateTime>2011-11-21T21:00:24Z</dateTime>
</answer>
<answer>
<user>
<firstName>john</firstName>
<lastName>wright</lastName>
</user>
<text>
not so happy
</text>
<dateTime>2011-11-21T21:00:24Z</dateTime>
</answer>
</question>
</questions>
<comments/>
</userContent>
我需要做的是显示
1)“questions/question/text”标签
2)显示该问题的所有答案是这个标签
“的问题/问题/答案/用户/名字” 标签
& 3) “的问题/问题/答案/文本” 标签
是否有可能在传统的ASP办?
我想读XML元素,表达如何定期将帮助?因为我知道正则表达式用于匹配内容不读取XML的所有元素? – user580950
你可以使用正则表达式来匹配所有问题的answer.texts,例如 –
不要使用正则表达式来完成这个任务,yikes! – AnthonyWJones