ok, I figured it out. I can use keepdata in the new()
method.
"When this option is enabled XML::SemanticDiff will add
the
'old_value' and 'new_value' properties to each warning.
These
properties contain, surprisingly, the old and new values for
the
element or attribute being reported.
In the case of missing elements or attributes (those in the
first
document, not in the second) only the 'old_value' property
will be
defined. Similarly, in the case of rogue elements or
attributes (those
in the second document but not in the first) only the
'new_value'
property will be defined."
On 1/31/07, sharif islam <sharif.islam gmail.com> wrote:
> I am using the following code borrowed from cpan. Is
there a way to
> return the values of the elements with this module? I
am interested in
> comparing an old and new file and return the elements
that are missing
> in the old one.
>
> use XML::SemanticDiff;
> my $diff = XML::SemanticDiff->new();
> my $file="old.xml";
> my $file2 = "new.xml";
>
> foreach my $change ($diff->compare($file, $file2))
{
> print "$change-> in context
$change->n";
> }
> my $diff = XML::SemanticDiff->new(keeplinenums
=> 1);
> foreach my $change ($diff->compare($file, $file2))
{
> print "$change-> (between lines
$change->
> and $change->)n";
> }
>
> --sharif
>
_______________________________________________
Perl-XML mailing list
Perl-XML listserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
|