Okay, fair enough. Thanks. I'm zeroing in on a possible solution anyway.
I figure I can implement a Traversal.Handler that will return null from
all its methods and traverse from the root element. The enterElement
method would call Node.getXPath() on the input argument and use the
result to query the other tree and do a comparison node for node. Would
this be too costly to work on a realistic document tree?

Regards,
Matt

-----Original Message-----
From: Hussein Shafie [mailto:[email protected]] 
Sent: 12 November 2008 15:48
To: Matt Flaherty
Cc: xmleditor-support at xmlmind.com
Subject: Re: How to compare two XML trees

Matt Flaherty wrote:
> I think I need to clarify the problem a bit.
> The comparison will be done with two trees "as is" and without 
> interaction with a user.

OK.



> I just want to recursively compare the "updated" tree to the base one 
> and make a decision about whether and what type of change has occurred

> at each node. What I'd like to know is how can I compare the two trees

> efficiently through the Traversal interface

The Traversal utility cannot help you to do that. There is currently
nothing in the XXE API which could help you to do that.



> and how can I exploit the DocumentListener (or UndoManager) interface 
> to see what changes I've applied to the base tree to bring it up to 
> date?

I'm sorry but it is very difficult to answer the above questions.



> I could also dress up the nodes of the base tree with deltaxml markup 
> and use Xpath to get at the results. There are numerous ways I could 
> go about this, but I want to reuse as much purpose built functionality

> as I can.




This email and any files contained therein is confidential and may contain 
privileged information.  If you are not the named addressee(s) or you have 
otherwise received this in error, you should not distribute or copy this e-mail 
or use any of its content for any purpose. Please notify the sender immediately 
by e-mail if you have received this e-mail in error and delete it from your 
system

Reply via email to