[XML-SIG] comparing xml documents
Rich Salz
rsalz@zolera.com
Wed, 29 Aug 2001 21:52:21 -0400
> Hmm, in that case, doc1.toxml()==doc2.toxml() is probably just right, then?
I'm not sure. The following are semantically equivalent:
<a foo='fooval' bar='barval'/>
<a bar='barval' foo='fooval'></a>
<a xmlns='' bar='barval' foo='fooval'/>
Should the compare the same? Probably. I'd be surprised if the toxml
method worked.
> What do folks generally do when they want to compare two xml documents?
You have to do something like convert them to a canonical form and
compare those. Luckily :), pyxml (the CVS version, not yet the released
version) has XML C14N code. You can rip that out and use it
stand-alone. (Shameless plug) you can also find it on the W3C web site,
look for XML Digital Signature.
Hope this helps.
/r$
--
Zolera Systems, Securing web services (XML, SOAP, Signatures,
Encryption)
http://www.zolera.com