[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Comparing 2 xml documents
"Yakkala, Raman" wrote:
> I am in the need of comparing 2 xml documents to see whether both of the
> documents represents the same stuff. The spacing may be different in the
> documents. Are there are any libraries available for comparison?
If Perl is part of your bag of tricks, you might want to have a look at
the XML::SemanticDiff module. It provides any easy way to compare XML
instances while ignoring insignificant whitespace differences and doing
the Right Thing(tm) with regard to XML Namespaces (elements
<foo:element/> <bar:element/> and <element/> are counted as equivalent
as long as they are bound to the same namespace and are otherwise
As a bonus, the implementation is built upon a simple event-handler
mechanism that offers an easy way to add side effects to the 'diff-ing'
process (insert/update data to databases, widget callbacks, etc.).