Is there a way to format XML so that a script will write a file like this:

      <category name="category 1">
            <model name="Item 1"/>
instead of like this:
<product><category name="category 1"><item name="Item 1"/></series></product>
It drives me nuts when I open an XML file and there's a long set of data with no line breaks or indenting.