Read from xml

I have an xml file like this:
<root>
<main name=“first”>
<image name = “” path = “” &gt;
<image name = “” path = “” &gt;
… will be 12 images
</main>
<main name=“second”>
<image name = “” path = “” &gt;
<image name = “” path = “” &gt;
… will be 12 images
</main>
… will be 5 main
</root>

So I will have 5 sets of 12 images.
I have to do a project which will load each set separated from the other. Because it could be a time when a set is empty and I want to skip it.
Basically I want to read a set on a click.
Something like this: I have a button, I press it and I load <main name=“second”> set, if main name =“second” is empty the others are empty to.
I don’t start with <main name=“first”> when I click, because this one is full and I have to load it first on stage.
So I have to read the first set, show it, and then after I press the button to read the second set etc.
Any suggestions?
Thank you.