Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    Parsing XML: get NoteValue ??

    Hello, I'm trying to parse an xml document to and get the node value,

    currently, i can get the node text. but I can't can figure out how to get the value.

    my xml looks like this:

    PHP Code:
     <ParkRec SerialNumber="00015026" ParkingDateTime="2007-10-15T08:59:00" ParkingZone="1" ParkingDuration="0" PCUSerialNumber="00" ParkingDebit="0" BankAfter="4859" BatteryStatus="OK" /> 
    and my code so far:
    PHP Code:
    Dim srcFile
    srcFile 
    "MY-URL"
    Response.Buffer True
    Dim objXMLHTTP
    xml
    Set xml 
    Server.CreateObject("Microsoft.XMLHTTP")
    xml.Open "GET"srcFileFalse
    xml
    .Send

    myXML 
    xml.ResponseText
    Set xmlResponse 
    Server.CreateObject("MSXML2.DomDocument")
    xmlResponse.async false
    xmlResponse
    .LoadXml(myXML)
    Set xmlHttp Nothing
    Set objLst 
    xmlResponse.getElementsByTagName("ParkRec")
    Set xmlResponse Nothing
     get number of lines returned
    intNoOfHeadlines 
    objLst.length -1

    For 0 To (intNoOfHeadlines)
        
    Set objHdl objLst.item(i)
        for 
    each child in objHdl.childNodes
            response
    .write (child.NodeValue)
        
    next
    Next
    Set xmlResponse 
    Nothing
    Set xml 
    Nothing 

    any help would be great!
    thanks in advance for your time

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    ok, i've figured it out. here's the code incase anyone else needs it,

    PHP Code:
    For 0 To (intNoOfHeadlines)
        
    response.write "<tr>"
        
    Set objHdl objLst.item(i)
        If 
    objHdl.Attributes.length 0 Then
            
    For Each Attribute In objHdl.Attributes
                
    If Not Attribute.Name "CometSerialNumber" Then
                    Response
    .Write "<td>" Attribute.Value "</td>"
                
    End If
            
    Next
        End 
    If
        
    response.write "</tr>"
    Next 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •