Vba msxml in vba in Excel
MSXML stands for Microsoft XML Core Services, now legacy, was a set of services that allowed applications written in JScript, VBScript, and Microsoft development tools to build Windows-native XML-based applications (reference wikipedia)
As we saw in the previous chapters, that the XML has a tree like structure, as defined by DOM.
Therefore, to read the contents of the XML document, it has to be traversed in a specific manner, that is, tree path manner.
So, understanding various nodes and its way of access is very important in traversing a XML document.
The various elements in VBA to access the XML nodes is as discussed below.
To use various XML related elements, the following Add-in has to be referenced.
Microsoft.XML, v6.0
This can be done as shown in the screenshot below
Now, the various elements under this Add-in are discussed below:
1.IXMLDOMNode
This is used to get a XML Node, generally, the root node.
2.IXMLDOMAttribute
This is used to represent an XML Attribute.
3.SelectNodes
This selects a list of nodes based on the Xpath pattern.
4.SelectSingleNode
This is used to select a single node; that is, the first matching node from the XML document.
5.ChildNodes
This is used to select a child node based on the pattern.