as3/flex xml toString : order of attributes in output string not always the same
I create an XML object in as3 and set some attributes.
var objectXML:XML = <test/>;
objectXML.@['one'] = '1';
objectXML.@['two'] = '2';
Than I get a string represen开发者_Go百科tation of this XML to save it somewhere:
objectXML.toString();
Once I have :
<test one="1" two="2"/>
another time I have :
<test two="2" one="1"/>
I need to have same results for the same objects to be able comparing hashes of the strings. How can I have same order of attributes always?
Not possible I think. That's not how XML is for and if you want this kind of behaviour, you need to use another data structure.
精彩评论