[jdom-interest] how to compare a jdom tree with lot of xml files present in a directory

Per Norrman per.norrman at austers.se
Fri Aug 20 07:34:43 PDT 2004


awais hamid wrote:

> hello friends
> i want to compare a jdom tree with lot of xml files present in a 
> directory .I am too much confused.
> How to do it ??In other words i want to compare two jdom trees in a 
> senario when we have to load jdom trees from files present on the 
> disk??????

Hi,

what is the purpose of the comparison?

A) If you just want to test for equality or simple line diffs,
your best bet is probably to serialize the JDOM Document and
use a common diff tool. (However, this can be problematic if the
disk based XML files hasn't been serialized with the same mechanism.
In this case you must employ XML canonicalization on all documents
before doing a comparison).

B) If you want to perform a more sophisticated comparison, e.g.
subtree differences,  there are plenty of XML diff tools available.
Google for "java xml diff".

/pmn





More information about the jdom-interest mailing list