开发者

as3/flex xml toString : order of attributes in output string not always the same

开发者 https://www.devze.com 2023-02-12 04:37 出处:网络
I create an XML object in as3 and set some attributes. var objectXML:XML = <test/>; objectXML.@[\'one\'] = \'1\';

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消