asp遍历xml节点

 加入了element节点的属性遍历

sub getnodes(node) 
dim i,j
'on error resume next
    response.write("<p><b>NodeName:</b>"&node.nodename&"<br><b>NodeTypeString:</b>"&node.nodetypestring&"<br><b>NodeValue:</b>"&node.nodevalue&"<br><b>Text:</b>"&node.text&"<br><b>node.childnodes.length:</b>"&node.childnodes.length&"<p><b>node.attributes:</b><br>"
    
    
if node.childnodes.length<>0 then 
    
for i=0 to node.childnodes.length-1 
        
if node.childnodes(i).nodetypeString="element" Then 
            
if node.childnodes(i).attributes.length<>0 Then 
                
for j=0 to node.childnodes(i).attributes.length-1
                    response.Write(
""&node.childnodes(i).attributes(j).nodename&":"&node.childnodes(i).attributes(j).text&"<br>")                    
                
next
            
end if         
        
End if 
        getnodes(node.childnodes(i))         
    
next 
    
end if 
end sub 
原文地址:https://www.cnblogs.com/xq/p/398307.html