Archived Forum Post

Index of archived forum posts

Question:

XML VBScript looping to get values

Jun 20 '13 at 07:35

I have found the samples very helpful in extracting values from xml documents. I am using the ActiveX, XML Parser Component. Unfortunately, I have not had success in extracting values the "material" section from the example below. Specifically, I am trying to pull out the value, <amount> value, and <value's unit value ("lb") for the two material sections. Here is an example of the expected values:

m223412, 4250, lb m532235, 4530, lb

How do I extract the value and attribute with a vbscript?

<send_batch> <ticket>10-01A</ticket> <cpticketid>21671</cpticketid> <cpbatchid>47183</cpbatchid> 2 <start_datetime>2013-06-14T14:37:27</start_datetime> <recipecode>R105025</recipecode> <recipeinstance/> <truckcode>T234</truckcode> <amount unit="m3">3</amount> <materials> <material> m223412 <bin>A1</bin> <hopper>96052</hopper> <target unit="lb">4240</target> <targetadjusted unit="lb">4240</targetadjusted> <amount unit="lb">4250</amount> <moisture unit="%">1</moisture> <density unit="kg/m3">2640</density> </material> <material> m532235 <bin>A7</bin> <hopper>96052</hopper> <target unit="lb">4540</target> <targetadjusted unit="lb">4540</targetadjusted> <amount unit="lb">4530</amount> <moisture unit="%">1</moisture> <density unit="kg/m3">2640</density> </material> </materials> </send_batch>