How do I parse through this XML tree in VBScript? -


i'm trying parse through xml tree in vb script, i'm unable pull out values want. i'm pull name value (eg. chng_reqt_nb , chng_reqt_dtl_co), code have below, i'm able print out "column" , value associated each, example, below code , xml, print out below:

 column 13389 column /* notes */ 1) cr#145: new code table  

i print as

 chng_reqt_nb 13389 chng_reqt_dtl_co /* notes */ 1) cr#145: new code table 

could please point out i'm going wrong? below code , xml samples.

set objxmldoc = createobject("microsoft.xmldom")  objxmldoc.async = false  objxmldoc.load("result.xml")  set root = objxmldoc.documentelement  set rowlist = root.getelementsbytagname("row")  each row in rowlist      handlenode(row) next  sub handlenode(row)     each elem in row.childnodes         wscript.echo elem.tagname         wscript.echo elem.text     next end sub 
<?xml version="1.0" encoding="utf-8"?> <resultsets> <resultset xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <row> <column name="chng_reqt_nb">13389</column> <column name="chng_reqt_dtl_co">/* notes */ 1) cr#145: new code table</column> </row> </resultset> </resultsets> 

you need value of name attribute of nodes rather node names.

change

for each elem in row.childnodes     wscript.echo elem.tagname     wscript.echo elem.text next

into

for each elem in row.childnodes     wscript.echo elem.getattribute("name")     wscript.echo elem.text next

and code want.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -