Hmm,
Pretty new to parsing xml. I’m trying to get my head around parsing this xml structure dynamically so that I don’t have to know which elements have children in advance of parsing the xml.
Here’s the structure:
<menu>
<item name="portfolio">
<item name="sketches">
<item name="blackOnWhite">
<detail image="1.jpg"/>
<detail image="2.jpg"/>
</item>
</item>
<item name="paintings">
<item name="oil">
<detail image="1.jpg"/>
<detail image="2.jpg"/>
</item>
<item name="acrylic">
<detail image="1.jpg"/>
</item>
</item>
<item name="mixed medium">
<detail image="1.jpg"/>
</item>
</item>
</menu>
I tried using loops with hasChildNodes() and while (firstChild != null), but I can’t find the logic. Any pointers would be greatly appreciated!
Much respect!