Re: questions on XML::Simple




Quoth Jeff <dreamgear@xxxxxxxxx>:
I used the XML::Simple module to read some xml, which works great.

But when I write it back out with XMLout.. it's changed.

For example the input that looks like this:

<Summary>
<TotalOrders>1</TotalOrders>
<TotalLineItems>4</TotalLineItems>
<TotalQuantity>158</TotalQuantity>
</Summary>

ends up looking like this:

<Summary TotalLineItems="4" TotalOrders="1" TotalQuantity="158" />


Is it possible to have it written out in the same format it was read
from?

See the NoAttr option.

Is there another module that would do this?

There are lots of other XML modules (XML::Parser, XML::LibXML, the
XML::SAX modules, XML::DOM, ...) but if XML::Simple does what you need
it's probably better to stick with what you have. If your XML really is
always going to be as simple as you say you could try XML::Tiny, but
make sure you carefully read the list of what it does and doesn't
support.

Ben

--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
ben@xxxxxxxxxxxx Groucho Marx
.