Jump to content

Split XML by using getElementsByTagName


rameshkumarss

Recommended Posts

Please help me to split the child nodes for the below codingset objXMLDoc = server.CreateObject("Microsoft.XMLDOM") objXMLDoc.async = "false" objXMLDoc.loadXML(strresult)-------------------------strresult is<epxml> <trx> <mid>2</mid> <type>charge</type> <result>4</result> <message>created</message> <detail>https%3A%2F%2Fp-p-g.net%2Fcontinue_v2.php</detail> <tan>44234</tan> <etan>EN</etan> <descriptor>just for testing</descriptor> <retry>0</retry> <timestamp>232342342</timestamp> <action>urldecode detail and redirect</action> <amount>5</amount> <currency>USD</currency> <customer> <uid>13444</uid> <firstname>Anil</firstname> <lastname>Jack</lastname> <street>No 12</street> <zip>2345645665</zip> <city>washington</city> <state>NY</state> <country>US</country> <riskscore></riskscore> </customer> </trx></epxml>-------------------------For the above XML i can able to split upto currency by the following codedim strMidSet ElemList = objXMLDoc.getElementsByTagName("mid") strMid = ElemList.Item(0).text........Now i don't know to split the child element's like uid,firstname....<customer> <uid>13444</uid> <firstname>Anil</firstname> <lastname>Jack</lastname> <street>No 12</street> <zip>2345645665</zip> <city>washington</city> <state>NY</state> <country>US</country> <riskscore></riskscore> </customer>please help me to split the child nodes for the above.....

Link to comment
Share on other sites

Dim CustList = objXMLDoc.getElementsByTagName("customer")For i=0 to UBound(CustList)-1'UIDdim uid = CustList(i).getElementsByTagName("uid")strUID = uid.Items(0).text'FirstNamedim firstName = CustList(i).getElementsByTagName("firstname")strFirstName = firstName.Items(0).text'etc,etc

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...