using oxygen to re-order XML attributes

Questions about XML that are not covered by the other forums should go here.
esaruoho
Posts: 1
Joined: Mon Apr 19, 2010 12:24 pm

using oxygen to re-order XML attributes

Post by esaruoho » Mon Apr 19, 2010 1:07 pm

hi, i'd love to be able to use oxygen to re-order XML attributes, like this:

<item id="x" name="o" url="oo" desc="aa">
so that this "id, name, url, desc" for instance could become "id, name, desc, url".. on every row. how would i go about doing this, please?

also, can i get specific, defunct, attributes removed automatically?

Radu
Posts: 7028
Joined: Fri Jul 09, 2004 5:18 pm

Re: using oxygen to re-order XML attributes

Post by Radu » Mon Apr 19, 2010 2:18 pm

Hi,

In the Oxygen Preferences->Editor / Format / XML page there is a checkbox called Sort attributes which can be used to alphabetically sort attributes for a certain element.
If you want your own order and all items are siblings you can pass to the Grid page where you will edit the items in a table view and you will be able to move or delete columns.

You can also use regular expressions in the Oxygen Find/Replace dialog with the Regular expression checkbox checked and the Dot matches all unchecked to perform the sorting like:
Text to find:
id="(.*)" name="(.*)" url="(.*)" desc="(.*)"
Text to replace:
id="$1" name="$2" desc="$4" url="$3"

You can also use regular expressions like:
id="(.*)"
to match and replace with nothing the attributes which are not used anymore.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply