This works. Thank you Michael!

Sorry I missed it. I was looking for an overridden equals() method but I
guess the naming has to comply with the language-independent W3C
specification.

If interested, what I'm doing is polling for a smallish XML file (2KB) being
changed on a Windows file system. Date stamp checking and File content
String comparison with a previous version is clearly not robust: what if a
whitespace is inserted - the Document is still the same. So your answer to
my problem is precisely what I need. Once again thank you.



Michael Glavassevich-3 wrote:
> 
> Have you tried Node.isEqualNode() [1]?
> 
> [1]
> http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Node.html#isEqualNode(org.w3c.dom.Node)
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]
> 
> Rob Davis-5 <[EMAIL PROTECTED]> wrote on 12/05/2008 10:57:29 AM:
> 
>> I want to compare two Document objects.
>>
>> That is compare their contents to see if they are exactly the same. This
>> would mean recursively traversing through each node in the Document and
>> comparing it with the other Document.
>>
>> Is there are routine, method or library to do this already?
>>
>> If not then I could write my own, using a DOMTreeWalker for each
> Document,
>> they would be iterated through and as soon as an inequality encountered
> then
>> the code would indicating not equal.
>>
>> Another way might be to generate a checksum and compare, or perhaps even
> use
>> the checksum available from the file that the Document is created from.
>>
>> I've already searched google and this forum using the terms compare and
>> comparison. The closest I got was:
>> http://www.nabble.com/Node-equals()---to7319083.html#a7319083
>>
>> Which seems to be what I'm looking for in the original post of this
> thread
>> but the responses seem off topic and talk about "serializing entity defs
>> with quotes".
>>
>> Thoughts? Thanks in advance.
>>
>> --
>> View this message in context: http://www.nabble.com/How-to-compare-
>> Documents--Existing-library-method-available--or-use-DOMTreeWalker--
>> tp20856968p20856968.html
>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-compare-Documents--Existing-library-method-available--or-use-DOMTreeWalker--tp20856968p20912379.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to