I have a snippet of coding - listed below - in which I am having problems figuring out how to pull a node.
I have also listed the XML document. I can loop very well to extract the <SERVICEPROVIDER> without a problem.
But I have not been able to construct my loop to extract the <ITEMAMOUNT>.
I am thinking I need to use xmlElementsByTagName(el, name, recursive = FALSE) - but I don't know.
There be many. It certainly does not like my inner loop where I am trying to extract the <CATEGORY> and the <QTY>and the <DESCRIPTION>
My loop to process the <SERVICEPROVIDER> works correctly.
But when I try to extract the nodes under <ITEMAMOUNTLIST>, it spits in my face :( And probably rightfully so too.
I have also posted the xml document. And snapshot of the error message.
Any help appreciated.
set xdDoc = Server.CreateObject("MSXML2.DOMDocument.6.0") xdDoc.load "C:\VAXXML\SOMEVAX.XML" Set colChildNodes = xdDoc.selectNodes("///ITEMAMOUNT") 'xmlElementsByTagName(el, name, recursive = FALSE) 'xmlElementsByTagName("ITEMAMOUNT,"TRAVELCATEGORY") 'extract item amounts if xdDoc.parseError = 0 then 'extract item info for each objItem in colChildNodes vqty = objItem.selectSingleNode("DESCRIPTION") vremarks = objItem.selectSingleNode("REMARKS") response.write "<BR>QTY:" & vqty & " " & vremarks next else ' display error message end if 'end of extracting item info 'extract service providers Set colNodes = xdDoc.selectNodes ("//SERVICEPROVIDER") if xdDoc.parseError = 0 then for each objProvider in colNodes 'get provider info response.write "<BR> inside for/next" vsegnbr = objProvider.selectSingleNode("PROVIDERTYPE").text if vsegnbr <> "5" then vprovider = objProvider.selectSingleNode("SERVICEPROVIDERNAME").text vbegindate = objProvider.selectSingleNode("STARTDATE").text venddate = objProvider.selectSingleNode("ENDDATE").text response.write "<BR>Provider Type is: " & vsegnbr response.write "<BR>Provider is: " & vprovider response.write "<BR>Begin date is: " & vbegindate response.write "<BR>End date is: " & venddate end if next else ' display error message end if %>