I am trying to parse out specific "fields" in the XML sample below using VBA. For instance, I want to specifically parse the value from "Field1" and throw it into a variable. I'm having all sorts of trouble.
Here's a bit of sample code:
Sub test()
Set oXML = New MSXML2.DOMDocument
oXML.async = False
oXML.validateOnParse = False
oXML.Load ("C:\sample.xml")
Set oXmlNodes = oXML.selectNodes("/")
For Each oXmlNode In oXmlNodes
Debug.Print oXmlNode.Text
Next
End Sub
And here's the XML:
<?xml version="1.0" encoding="UTF-8" ?>
<form>
<metadata>
<prop name="formName">
<value>myTestForm</value>
</prop>
<prop name="formIdentifier">
<value>0000033</value>
</prop>
</metadata>
<field name="field1" type="String">
<value>something</value>
</field>
<field name="field2" type="String">
<value>something else</value>
</field>
</form>