I'm trying to import data from an XML file like this:
<library>
<book>
<title>aaa</title>
<author>aaa-author</author>
</book>
<book>
<title>bbb</title>
<author>bbb-author</author>
</book>
<book>
<title>ccc</title>
</book>
</library>
(note that the third book has no value for the author)
I would like to obtain an Excel table where each book's data are displayed on one row. The problem is that I do not understand how I have to loop on the book nodes to obtain their children values.
I'm working on code like this:
Set mainWorkBook = ActiveWorkbook
Set oXMLFile = CreateObject("Microsoft.XMLDOM")
XMLFileName = "C:\example.xml"
oXMLFile.Load (XMLFileName)
Set Books = oXMLFile.SelectNodes("/book")
For i = 0 To (Books.Length - 1)
' I cannot understand this part
Next