Help with some xml file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mysticslayer
    New Member
    • Feb 2008
    • 5

    Help with some xml file

    Here under you can find a sample xml file of a customer of us. I know it isn't the best file you ever saw, but they can't change it for some reason.

    Anyhow this is it:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <eExact>
      <method name="GetReport1">
    	<return name="Code">123456</return>
    	<return name="Document">
    	 <Attachment>
    	  <Name>WP501FOv1_1.pdf</Name>
    	  <BinaryData xmlns:dt="urn:schemas-microsoft-com:datatypes"  dt:dt="bin.base64">
    </BinaryData>
    	 </Attachment>
    	</return>
    	<return name="Startdate">01/01/2008 01:01</return>
    	<return name="Enddate">01/01/2008 01:01</return>
    	<return name="List2">0 of 1</return>
      </method>
    </eExact>

    I've written some vbscript to loop through the code, but I have the problem that I can't get to the nodetypedvalue for some reason. This is the sample code i've got.

    Code:
    call xmlHttp.Open("GET", "http://localhost/GetReport1.xml")   
    call xmlHttp.Send()   
      
    if(Err <> 0) then   
      Response.Write("An error occured when retrieving data from an external source.<br />")   
      
      Response.Write(Err.Description)   
      Response.End  
    end if   
      
    on error goto 0   
      
    if(xmlHttp.status <> 200) then   
      Response.Write("The remote server returned an invalid statuscode: #8221;" & xmlHttp.status & " " & xmlHttp.statusText)   
      Response.End  
    end if   
      
    if xmlHttp.responseXML is nothing then   
      Response.Write("The remote server didn’t return xml content.")   
      Response.End  
    end if   
      
    set xmlDom = xmlHttp.responseXML   
     
    set nodeCol = xmlDom.documentElement.selectNodes("method/return")   
      
    for each oNode in nodeCol.Attributes  
    	   
      Response.Write(oNode.nodeTypedValue) 		
            
    Next
    Well I got the StartDate / EndDate etc, but I don't get any values returned? What I can do to get the values instead of the names?
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    I think it'd be like:
    Code:
    for each oNode in nodeCol.Attributes  
    	   
      Response.Write(oNode.nodeTypedValue) 		
            
    Next 
    
    Response.Write(nodeCol.Text)
    See http://www.devguru.com/Technologies/...dom_intro.html for more info.

    Comment

    Working...