In VBScript, I have this XML document:
<m>
<x>300001
<y>10000294
<z>2120300003</z>
<z>2120300004</z>
</y>
<y>10000295
<z>2120300003</z>
<z>2120300006</z>
</y>
<y>10000296
<z>2120300001</z>
</y>
<y>10000302
<z>2120300002</z>
</y>
</x>
<x>300048
<y>10000294
<z>2120300002</z>
</y>
</x>
</m>
and I'd like to get the values of each of the <y> elements themselves, and not anything under it, into an array to compare the value against another data set later on in a loop. I've done a simple test with outputting the value, and the nodeValue property is always null.
My current code is:
dim matrixArray, y, outputText
set matrixArray = oXml.documentElement.getElementsByTagName("y")
outputText = ""
for each y in matrixArray
outputText = outputText & ", " & y.nodeValue
next
In the above, y.nodeValue is null. If I use y.text, it outputs the text of the node and all the text of <y> element's subtree. Similarly, y.nodeTypedValue also outputs the same as y.text. i.e. 1000029421203000032120300004, 1000029521203000032120300006, 100002962120300001, 100003022120300002, 100002942120300002
Note that I cannot change the structure of the XML document and must comply with it.
How do I just get the text of each of the <y> elements without getting any of the <z> element text under them? i.e. 10000294, 10000295, 10000296, 10000302, 10000294