Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Create Excel Spreadsheet from XML, loop through child nodes

$
0
0

I am working with the XML below trying to generate an Excel spreadsheet from it.  It is mostly working fine but I am having issues with a loop inside a loop. 

<storagecell>

<object>

<objectname>Tigger1</objectname>

<objecttype>storagecell</objecttype>

<totalstoragespace>500</totalstoragespace>

</object>

</storagecell>

<host>

<object>

 <fcadapterports>

<port>

<portwwn>8b4c-1345</portwwn>

</port>

<port>

<portwwn>093v-d846</portwwn>

</port>

</fcadapterports>

</object>

</host>

Sub FillHostsReport(ByRef objXLA, ByRef objConfigXml, ByVal myTime, ByVal sheetNumber, ByRef iY)

    Dim objHosts, objMap

    Set objSheet = objXLA.Workbooks(1).WorkSheets(sheetNumber)

    Set objHosts = objConfigXml.selectNodes("//storagecell/object")

    For Each objMap in objHosts

    Set objSingle = objMap

            objSheet.Cells(iY,2).Value = objSingle.selectSingleNode("objectname").Text

            objSheet.Cells(iY,3).Value = objSingle.selectSingleNode("objecttype").Text

            objSheet.Cells(iY,4).Value = objSingle.selectSingleNode("totalstoragespace").Text

   iY=iY+1

   Next

What I need is Column 5 to contain rows of the portwwn values which could be many.  So far any code that I have used has only resulted in the first portwwn value.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>