OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] Comparing 2 xml documents





"Yakkala, Raman" wrote:
> 
> Hello,
> 
> 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[1]. 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
identical).

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.).

HTH,
-kip

[1]
http://search.cpan.org/doc/KHAMPTON/XML-SemanticDiff-0.93/SemanticDiff.pm