Hi,

here's the new extension i'd like to propose to be taken into PECL

http://belski.net/phpz/xmldiff-0.7.3.tar.gz

Here's the example of how it can work:

$from = "<root><a /></root>";
$to = "<root><b /></root>";
$xdiff = new XMLDiff\Memory;

$diff = $xdiff->diff($from, $to);
$new = $xdiff->merge($from, $diff);

The extension is able to produce diffs of two XML documents and then to
apply the difference to the source document. Whereby the diff is an XML
document containing copy/insert/delete instruction nodes and is human
readable. The diff corresponding to the snippet above would look like

<?xml version="1.0"?>
<dm:diff xmlns:dm="http://www.locus.cz/diffmark";>
  <root>
    <dm:delete>
      <a/>
    </dm:delete>
    <dm:insert>
      <b/>
    </dm:insert>
  </root>
</dm:diff>

So far three comparsion possibilities are implemented:

- DOMDocument objects
- local files, based on the pure libxml functionality
- xml documents in memory, based on the pure libxml functionality

Files and memory methods are relatively simple, comparing DOM objects
would of course require some more resources.

The xmldiff extension is inspired by the perl module DifferenceMarkup,
which can be found under
http://search.cpan.org/~vbar/XML-DifferenceMarkup-1.04/lib/XML/DifferenceMarkup.pm
. The underlaying library libdiffmark is in public domain. It's bundled
and is used by the xmldiff extension, which itself i'd like to put under
the BSD license.

Ideas about functionality improvements are highly appreciated.

Cheers

Anatol

-- 
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to