开发者

Flex - How to change xml attribute name?

For example I want to change

&l开发者_Python百科t;item id="1"/>

to

<item code="1"/>

thanks.


You can use setName to change the attribute name:

Here for example change all your id attributes with code:

var xmlTest:XML=<r><item id="1"/></r>;

for each (var node:XML in xmlTest.item.descendants("@id"))
 node.setName("code");

trace(xmlTest); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜