R
Red Ryder
I have written a simple recursive parser in VBA (Word - Office 2003)
to parse the XML-like information out of a Word document.
Now I would like to store it as a DOM tree uing the XML-API provided.
An example would be as follows. Although I can walk through a DOM
created by the XMLDoc.Load method, I cannot add to it or create one
from scratch.
Can you suggest a simple example which creates a DOM tree using VBA.
Thanks
Sub listall()
Dim xmlDoc As New DOMDocument
Dim currNode As IXMLDOMNode, newNode As IXMLDOMNode, refNode As
IXMLDOMNode, _
rootNode As IXMLDOMNode
Dim oNodeList As IXMLDOMNodeList
Set rootNode = xmlDoc.documentElement
'
' Create a new element and insert it before the last child of the
top-level node.
'
Set newNode = xmlDoc.createNode(1, "FUBAR", "JUNK")
Set currNode = rootNode.InsertBefore(newNode, rootNode.LastChild)
dah, dah dah
to parse the XML-like information out of a Word document.
Now I would like to store it as a DOM tree uing the XML-API provided.
An example would be as follows. Although I can walk through a DOM
created by the XMLDoc.Load method, I cannot add to it or create one
from scratch.
Can you suggest a simple example which creates a DOM tree using VBA.
Thanks
Sub listall()
Dim xmlDoc As New DOMDocument
Dim currNode As IXMLDOMNode, newNode As IXMLDOMNode, refNode As
IXMLDOMNode, _
rootNode As IXMLDOMNode
Dim oNodeList As IXMLDOMNodeList
Set rootNode = xmlDoc.documentElement
'
' Create a new element and insert it before the last child of the
top-level node.
'
Set newNode = xmlDoc.createNode(1, "FUBAR", "JUNK")
Set currNode = rootNode.InsertBefore(newNode, rootNode.LastChild)
dah, dah dah