Re: Is there a diff-like utility for SXML documents?
"Dmitry Lizorkin" <[email protected]> Wed, 17 Aug 2005 18:08:59 +0400
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Message-ID | <[email protected]> |
Hello!
You may be interested in looking at the following _naive_ diff tool for
SXML:
http://modis.ispras.ru/Lizorkin/Download/Tmp/sxml-diff.scm
Node matching implemented there is not quite intellectual, although
sufficient for our practical tasks.
Given two SXML nodes, the function `sxml:diff' returns the differences
between them in the form of a list (the empty list is returned for
equavalent SXML nodes):
(sxml:diff
'(table
(@ (class "code-sample") (align "center") (border 0))
(tr "First table row")
(tr "Second table row")
(tr "Third table row" (br)))
'(table
(@ (border 0) (align "left") (class "code-sample") (width "80%"))
(tr "First table row")
(tr "Third table row" (br))))
==>
((diff
(message "Attribute value changed")
(fragment1 (@ (xpath "/@align")) "center")
(fragment2 (@ (xpath "/@align")) "left"))
(diff
(message "Attribute inserted")
(fragment2 (@ (xpath "/@width")) (width "80%")))
(diff
(message "Node deleted")
(fragment1 (@ (xpath "/tr[2]")) (tr "Second table row"))))
> (Described and analyzed at length in this thesis:
http://www.cs.hut.fi/~ctl/3dm/thesis.pdf.)
>
> Here is another approach:
www.cis.upenn.edu/~bcpierce/papers/harmony-sync-tr.pdf
Chris, thank you a lot for the useful links.
I can also recommend the following older paper:
http://citeseer.ist.psu.edu/chawathe96change.html
Best regards,
Dmitry
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf