Sort XML attributes in Eclipse
I'm using Eclipse 3.6.2 and the Android Development Tools plug-in. In layouting apps, I use both the Graphical Layout and XML source editors.
After using the graphical editor, I can format the XML source with the XML preferences and Command+Shift+F
. How do I sort XML at开发者_运维技巧tributes alphabetically?
In XML the order of attributes is not significant, so most XML tools assume that they can output attributes in an arbitrary order and the user will not care. Indeed, any downstream processing that depends on the order of attributes is faulty.
I can see that controlling the display order of attributes can be useful for the human reader even if it actually carries no information, but I don't know of any tools that allow you to control this.
Looks like Eclipse ADT 13 will be able to sort your Android XML attributes. http://code.google.com/p/android/issues/detail?id=16890
精彩评论