Well, you could put Saxon's output through an XML canonicalizer: some of my test suites use a canonicalizer produced years ago by James Clark. Or you could tweak the Saxon serializer. With the new features in 8.8 this shouldn't be too hard:
 
* create a subclass of XMLEmitter in which you intercept the calls on attribute() and namespace() and startContent() to buffer the attributes and sort them
 
* subclass SerializerFactory, overriding the newXMLEmitter() method to instantiate your subclass of XMLEmitter
 
* register this subclass of SerializerFactory with the Configuration object
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Martin Wegner
Sent: 29 September 2006 19:54
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Attribute Order


Whenever I see someone write into this list about having trouble with the order of attributes in a serialized XML message, I always laugh.  But now I am laughing at myself.  I have found myself in the difficult spot where I need two different machines, with the same JARs, JRE and classpath, to produce the same sequence of bytes for a given DOM.  Is there any solution to this aside from writing my own serializer?

And yes, you can start laughing.


--Marty