[opensource-dev] XUI Cleanup Project
kadah.coba at gmail.com
Fri Aug 3 15:32:41 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
This weekend I was working on some XUI files and my OCD (I don't
actually have OCD) was getting very frustrated over the random
formatting, lack of consistent indentation, trailing whitespace,
random/missing newlines and wildly differently sorted arguments.
Usually I'd either completely retab the file or give up, but I was
lazy and tired of not doing anything. So needless to say I got nothing
done on in XUI and spent the few days writing a script to reformat XUI
files to some level of code standards.
There is no XML code standards on
So I used my own, which were as such:
* Unix EOLs
* Child elements indented +4 spaces
* Each argument on onw line and indented +1
* Arguments sorted by defined list then alpha order
(eg. 'name' and composting before random control specific args)
* Comments must be preserved
Initially I looked for existing tools/libs that can do XML cleanup,
but I had the same results I found the last time I looked, that none
of them could cover all the requirements. Surprisingly comment support
was actually hardest to find support for, unsurprisingly argument
sorting is extremely uncommon and the ones that did were poor.
After that I attempted to find an XML lib for parsing, but found that
pretty much all of them did not support comments or the tabled output
So I ended up writing the XML parser and reserializer myself.
Everything appears to output correctly, but I lack a diff tool that
supports XML to be able to do verification. The text diff tools I'm
familiar with can only do word/character comparisons and the reordered
args, and sometimes drastically improved whitespace, make manual
So does anyone know of a, preferably, open source XML diff tool?
I'm guessing it could be possible to extract some of the XML/XUI file
parsing from the viewer and make one, but it would be a pain in the rear.
If this works out, I'll release the scripts (MIT licensed), and submit
the requisite jira/RB to push upstream XUI cleaned up, which would be
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the opensource-dev