Microsoft XML v6.0

Adding this reference allows you to use the MSXML application programming interfaces from within VBA.


It is possible to treat an XML file as a text file and parse it using traditional methods but is not very efficient.
However because the XML data is structured it is far easier to use an XML parser instead.
There are lots of different type of XML parsers but for the purposes of VBA you will want to use a parser that supports XML Document Object Model (DOM).
An XML parser that supports DOM will take the XML data and expose it via a set of objects that we can program against.


Microsoft XML Parser (MsXML.dll)

This is an XML parser which supports DOM that can be used in VBA to access and manipulate XML data.
(Tools > References)
C:\windows\system32\msxml6.dll



Document Object Model (DOM)

This defines a set of standard commands that parsers should expose to allow you to access XML content.
The DOM represents a treeview of an XML document letting you easily navigate its structure and add, modify or remove elements.
The documentElement is the top level of the tree.
This element has one or more child nodes.


link msdn - aa468547
KB - 304265
KB - 253732


Dim oDOMNodeList As MSXML2.IXMLDOMNodeList 
Dim oXMLDoc As MSXML2.DOMDocument
Dim oNode As MSXML2.IXMLDOMNode

oXMLDoc = New MSXML2.DOMDocument
oXMLDoc.LoadXML(oDOMNodeList(1).XML)
oDOMNodeList(1).SelectSingleNode("--").Text
oXMLDoc.documentElement.childNodes(1).childNodes(1).Text




© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext