From: "Donald Ball" <[EMAIL PROTECTED]>
> > I can't see anything wrong with the code. Could it be that
NodeComparator
> > compares the names of hte documents as well? (A document has a name).
Maybe
> > we should patch NodeComparator to not use the document name in the
> > comparison.
>
> why do documents have names? do documents have any other attributes
> which are not serialized as xml?
The name can be used to help find relative schema/dtds - though it shouldn't
be used in the compare. Will patch.
> > You can test if this is the issue by....
> >
> > Document doc1 = ...;
> > Document doc2 = ...;
> >
> > doc1.setName( "foo" );
> > doc2.setName( "foo" );
> >
> > if ( comparator.compareTo( doc1, doc2 ) != 0 ) {
>
> ha ha! no, it actually made things worse! before,
> comparator.compare(doc1, doc2) returned 1. now, it returns 6 (?!)
>
> along these same lines, is there a diff utility for dom4j? any interest
> in one?
Sure!
I seem to remember IBM doing one that was based on W3C DOM.
Incidentally whenever 2 docs are different and you're trying to figure out
why, deriving from the org.dom4j.AbstractTestCase class in dom4j/src/test
could be useful. Its got a lot of JUnit style assertion helper methods. So
if you do....
public MyTest extends AbstractTestCase {
public void testFoo() throws Exception {
...
assertDocumentsEqual( doc1, doc2 );
}
then it will tell you exactly what is different between the docs. Just
getting a positive number isn't that helpful ;-)
James
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user