zoukankan      html  css  js  c++  java
  • 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 
  • 相关阅读:
    java的反射机制浅谈 分类: java
    2.4.3 Cow Tours
    2.4.2 Overfencing
    2.4.1 The Tamworth Two
    Shortest Paths
    2.3.5 Controlling Companies
    2.3.4 Money Systems
    2.3.3 Zero Sum
    2.3.2 Cow Pedigrees
    2.3.1 Longest Prefix
  • 原文地址:https://www.cnblogs.com/xq/p/398307.html
Copyright © 2011-2022 走看看