Reading XML File With Classic ASP
I have done lots og googling but did nto find the resolution to my problem.
I have to read XML string, parse it and store the values in database as well as I have to show it to the user.
Following the code I wrote to show the parsed XML on the web. It is working
Code:
My XML String
<?xml version="1.0" encoding="utf-8"?>
<get-subscriber-call-hdr trid = "2065961">
<history>
<call>
<id>9696705</id>
<narrative>1234</narrative>
</call>
<call>
<id>9696706</id>
<narrative>1234</narrative
</call>
</history>
</get-subscriber-call-hdr>
Code:
Function ParseCDRXML(strXML)
Dim objXML,objRoot ,I, thisNode,strID, strNarrative
Set objXML= Server.CreateObject("Microsoft.XMLDOM")
objXML.async = False
objXML.loadXML(strXML)
Set objRoot = objXML.documentElement
For I = 0 TO (objRoot.childNodes.length - 1)
Set thisChild = objRoot.childNodes(I)
strID = thisChild.childNodes(0).Text
strNarrative = thisChild.childNodes(2).Text
DoSomething strID,strNarrative
Next
End Function