Skip to content
edeustace edited this page Mar 28, 2012 · 2 revisions

#Namespace ordering

##Introduction

The rules that decide how to sort the namesspaces and attributes are external to the script. If you are running the ruby script you can edit these if you so wish. This will explain how they work.

###Details

The organizing uses the default sort rules file: lib/cleaner/rules/namespace_rules.txt

Which look like:

/xmlns:mx$/
xmlns
/xmlns:(mx.+|[^mx].*)/

What this ordering is going to be:

xmlns:mx
xmlns
xmlns:***
{all remaining attributes will be sorted alphabetically}

if you look at lib/cleaner/rules/namespace_rules_custom.txt

you will see an example of a customised sort rule.

/xmlns:mx$/
xmlns
/xmlns:(mx.+|[^mx].*)/
implements
id
height,width
x,y
addedToStage,change,creationComplete,initialize,preInitialize
/.*?Align/
horizontalScrollPolicy,verticalScrollPolicy
backgroundAlpha,backgroundImage

Like the previous example we have the xmlns at the top, however then we have declared some other rules for the remaining attributes. In this case after the namespaces will follow "implements" then "id", then "height" the optionally "width".

The forward slash at the start and end of the line indicates a Regular Expression. Attributes that are listed on the same line and separated by a "," mean that they share the same group order, but internally they'll be sorted amongst themselves.

Clone this wiki locally