See the ForceArray attribute in XML-Simple. See some of the other attributes also whenever you need to adjust things to get exactly the output you want. If/when it gets too hard or impossible to adjust things the way you want, see XML-Rules or XML-Twig to get things done how you want them.