ASP Classic - XML Dom

后端 未结 3 409
别跟我提以往
别跟我提以往 2020-12-17 03:13

I\'ve got the unpleasurable task of working on a Classic ASP site (VBSCRIPT) and need to parse out the following information in a loop.


  

        
3条回答
  •  悲&欢浪女
    2020-12-17 03:29

    Switch to using xpath instead and it will be much easier.

    Dim nodes
    nodes = objXML.selectNodes( "//products" )
    
    Dim images
    
    For each node in nodes
        Response.Write( "
      " ) Response.Write( "
    • Ref: " + node.selectNodes( "@ref" ).Text + "
    • " ) images = node.selectNodes( "images/image" ) For each image in images Response.Write( "
    • Image: " + image.selectNodes( "@ref" ).Text + "
    • " ) Next Response.Write( "
    " ) Next

    I'm a JScript ASP coder, like you not done VBScript for an age so the above "might" need a bit of polish (I had to strip out all the ";" at the end of the all the lines, such is the habit of adding them) but should point you in the right direction at least.

    Hope that helps.

提交回复
热议问题