Hey,
So I'm opening XML files in Word and using VBA to extract data from certain XML nodes using DOM. My Code looks like this:
And this is what the XML node I'm using looks like:
With the code I have right now, all I can do is grab the entire "CUSTOMER" node, but all I want to only extract the "NAME" portion (Jim). My code prints out as:
"<CUSTOMER NAME="Jim" LAST_NAME="Smith" ID="1748"/>
Does anyone know of any way to access the "NAME" portion of the node without grabbing the whole thing? Or even what the "NAME", "LAST_NAME" and "ID" portions of the node are referred to as? Then maybe I could find a method that would access them. Any help would be awesome!
Thanks.
BitNet
So I'm opening XML files in Word and using VBA to extract data from certain XML nodes using DOM. My Code looks like this:
Code:
Sub Extract()
Dim xmlDoc As MSXML2.DOMDocument
Set xmlDoc = New MSXML2.DOMDocument
Dim nodeList As MSXML2.IXMLDOMNodeList
Dim str As String
xmlDoc.Load("C:Documents...\Document.xml")
Set nodeList = xmlDoc.getElementsByTagName("CUSTOMER")
str = nodeList.Item(0).XML
MsgBox str
End Sub
Code:
<CUSTOMER
NAME="Jim"
LAST_NAME="Smith"
ID="1784"
/>
"<CUSTOMER NAME="Jim" LAST_NAME="Smith" ID="1748"/>
Does anyone know of any way to access the "NAME" portion of the node without grabbing the whole thing? Or even what the "NAME", "LAST_NAME" and "ID" portions of the node are referred to as? Then maybe I could find a method that would access them. Any help would be awesome!
Thanks.
BitNet