View Full Version : Parsing XML: get NoteValue ??

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

myXML = xml.ResponseText
Set xmlResponse = Server.CreateObject("MSXML2.DomDocument")
xmlResponse.async = false
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)
Set xmlResponse = Nothing
Set xml = Nothing

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

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
End If
response.write "</tr>"