采用经典的ASP获取一个节点的属性值 [英] Using Classic ASP to get value of a node attribute
本文介绍了采用经典的ASP获取一个节点的属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下XML架构:
<?xml version="1.0" encoding="utf-8"?>
<PageMapping>
<Applications>
<Application name="xxx">
<Page name='Default.aspx' IsCaptured = "true" >
<Control name="btnSearch" IsCaptured = "true"/>
<Control name="btnSave" IsCaptured = "true"/>
<Control name="btnClick" IsCaptured = "true"/>
</Page>
<Page name='Login.aspx' IsCaptured = "true">
<Control name="btnSearch" IsCaptured = "true"/>
</Page>
<Page name='Home.aspx' IsCaptured = "true" >
<Control name="btnSearch" IsCaptured = "true"/>
</Page>
<Page name='User.aspx' IsCaptured = "true" />
</Application>
</Applications>
</PageMapping>
使用ASP
,我将如何得到名和IsCaptured的价值?我已经尝试了各种不同的方法,但似乎没有任何工作。任何想法?
Using ASP, how would I get the value of "name" and "IsCaptured"? I have tried all sorts of different methods, but nothing seems to work. Any ideas?
推荐答案
试试这个:
Set oXML = Server.CreateObject("MSXML2.DomDocument.4.0")
oXML.LoadXML(sXML) ' sXML is a variable containing the content of your XML file
For Each oNode In oXML.SelectNodes("/PageMapping/Applications/Application/Page")
sName = oNode.GetAttribute("Name")
sIsCaptured = oNode.GetAttribute("IsCaptured")
' Do something with these values here
Next
Set oXML = Nothing
这篇关于采用经典的ASP获取一个节点的属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文