XML-Simple - Re: how to preserve XML::Simple element order

Posted on Wed Dec 12 03:36:21 2007 by grantm in response to 6670 (See the whole thread of 3)
Re: how to preserve XML::Simple element order

Retaining element order is not and never will be a feature of XML::Simple. For some XML document types you might be able to hack it in by subclassing XML::Simple and overriding the new_hashref() method to supply a hashref tied to Tie::IxHash. That could solve the ABC case but it won't solve the ABA case.

The short answer is that if you care about element order then you should not use XML::Simple. XML::LibXML is an excellent alternative which for many use cases is really no harder to use than XML::Simple - as described in this article.

Direct Responses: 6676 | Write a response