...

View Full Version : Parsing XML: get NoteValue ??



angst
01-09-2008, 04:41 PM
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:



<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:


Dim srcFile
srcFile = "MY-URL"
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", srcFile, False
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 i = 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

angst
01-09-2008, 04:56 PM
ok, i've figured it out. here's the code incase anyone else needs it,



For i = 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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum