[XML-SIG] using XUpdate to render differences between two versions of a file

Bogdan Bivolaru bogdan.bivolaru at gmail.com
Fri Aug 8 09:18:43 CEST 2008


* Problem:
I'm trying for some time find a tool that makes a diff in XML files.
What I have found so far is XMLdiff (python program) which can save the
differences between the two files in XUpdate format, but I'd like to be able
to visualize those differences, see how they look in the final product.

The best idea I could find is to use the XUpdate file and based on a XSL
(specific to the format that is being diffed) to make transformations on the
versioned files in such a way that highlights the differences between them.

For example, for HTML it would be:
deleteted text to be marked as <strikethrough> .... </strikethrough>
inserted text to marked as <p style="color: red;">...</p>

SVGdiff could fade version 1 into version 2, or could allow other effects
like showing only the parts that have been added or deleted.

* Solution(s):
So my idea on implementing this is to replace the elements pointed in
XUpdate (/document_root[1]/element1[1]) and embed them in the markup
specified by the XSL.

File version 1:
      <mailbox path="/var/spool/mail/almaster"/>

File version 2:
      <box path="/var/spool/mail/almaster"/>

Doing "xmldiff -x file1 file2" gives an XUpdate output:
<?xml version="1.0"?>
<xupdate:modifications version="1.0" xmlns:xupdate="
      <xupdate:rename name="/memory[1]/mailbox[1]" >

After processing the XUpload the program would know it has to find
/memory[1]/mailbox[1] element in the first document and put <p
style="color:red;"> ... </p> around it. But how to do that? Or it could make
an intermediary XSL file that specifies this?

I'm not sure which way to go from here? Any ideas? Any word on performance?
I wouldn't like to keep all the document tree in memory just to find
/memory[1]/mailbox[1] element and replace it, do you know any alternatives?

Do you know any other way how to do this visual XML diff tool? Please share
with me.

"The best way to predict the future is to invent it.", 1971, Alan Kay:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/xml-sig/attachments/20080808/a6145d05/attachment.htm>

More information about the XML-SIG mailing list