Skip to content

a simple tool to normalize xml files to allow textual comparison

License

Notifications You must be signed in to change notification settings

Appdynamics/xml-normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xml-normalize

a simple tool to normalize xml files to allow textual comparison

it canonicalizes the xml file by recursively sorting elements. the attributes of elements are also sorted.

a very common use case is to normalize glassfish domain.xml files from disparate versions to see the substantive changes.

these can then be put under some source code discipline. the standard java xml writer does not output the domain.xml in any kind of canonical form.

the program has a trivial usage:

xml-normal.sh infile outfile

so

xml-normal.sh domain.xml domain-normal.xml

diff domain-prev.normal.xml domain-normal.xml will give a usable diff

I've swizzled together a simple modification that runs diff over two xml files that have been chewed on; this is found in xmldiff.sh

issues: this thing does not handle comments well. they are sorted together within the upper level element. ideally, we don't move comments or somehow bind them to the succeeding tag.

About

a simple tool to normalize xml files to allow textual comparison

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published