It isn’t a work around, but one of the many correct ways to work with
XML is a big topic area, but in practice it is often either documents
or hashes (associative arrays)
As stated by another, XML elements are only ordered by the nesting.
For an example of how this looks, export a playlist from iTunes as
XML and then look at the XML file. It isn’t immediately as human-
friendly as you might expect. However, the data structures are very
easy to manipulate.
iTunes’ interface is a great example of how you can push XML data
around and make it do things and appear different ways.
Simple key/value coding (hash, or associative array) works well as
XML and can be very easy to manipulate with simple array functions
(or methods) for sorting by alpha-numeric or by size or other things.
XML is intended to be a human-readable data format in a sense, but it
is also intended to be manipulated for presentation to most users.
Load your data into arrays (hashes) then you can order it however you
want to for immediate use.
If you really need some ordering, you have to load it into an array
or search it to sort and then serialize it by writing it to another
format (like YAML) or to a database table.
XML is nice but not always the best data format.
Sometimes inherently ordered data is necessary. But not very.