Leser: 2
|< 1 2 >| | 13 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
sub analyze_delta {
my ($self, %args) = @_;
use XML::DOM;
use XML::DOM::XPath;
$self->{'majorDOMus'} = XML::DOM::Parser->new()
unless $self->{'majorDOMus'};
my $id = $args{'id'};
my ($tree1, $tree2) = map { $self->{'majorDOMus'}->parse($_); } ${ $self->{'failures'}->{$id}->{'doc1'} }, ${ $self->{'failures'}->{$id}->{'doc2'} };
for my $delta ( @{ $self->{'failures'}->{$id}->{'deltas'} } ) {
my $path = $delta->{'context'};
my @nodes;
( @nodes = $tree1->findnodes($path) ) ?
1 :
( @nodes = $tree2->findnodes($path) ) ?
1 :
print "\nThere is no node at '$path'\n";
print "\n", $_->getData for @nodes;
print "\n", $_->toString, "\n" for @nodes;
}
}
Can't locate object method "getData" via package "XML::DOM::Element" at ../XmlDiffer.pm line 126.
Use of uninitialized value in string eq at /users/user4/usr/lib/perl5/site_perl/XML/SemanticDiff.pm
$from_doc->{$element}->{NamespaceURI} eq $to_doc->{$element}->{NamespaceURI}
$from_doc->{$element}->{TextChecksum} eq $to_doc->{$element}->{TextChecksum}
1
2
print "\nNODEVALUE: ", $_->XML::DOM::CharacterData::getData for @nodes;
print "\nTOSTRING: ", $_->toString, "\n" for @nodes;
$node->getData
Can't locate object method "getData" via package "XML::DOM::Element" at ../XmlDiffer.pm line 129.
print "\nNODEVALUE: ", $_->getNodeValue for @nodes;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0"?>
<spam-document version="3.5" timestamp="2002-05-13 15:33:45">
<!-- Autogenerated by WarbleSoft Spam Version 3.5 -->
<customer>
<first-name>Joe</first-name>
<surname>Wrigley</surname>
<address>
<street>17 Beable Ave.</street>
<city>Meatball</city>
<state>MI</state>
<zip>82649</zip>
</address>
<email>joewrigley@jmac.org</email>
<age>42</age>
</customer>
</spam-document>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
use strict;
use warnings;
use XML::DOM;
use XML::DOM::XPath;
use XML::SemanticDiff;
my ($file1, $file2) = @ARGV;
my $doc1 = do { local(*ARGV, $/, $_); @ARGV = $file1; <>; };
my $doc2 = do { local(*ARGV, $/, $_); @ARGV = $file2; <>; };
my $differ = XML::SemanticDiff->new(keepdata => 1,);
my @deltas = $differ->compare( $doc1, $doc2 );
my $majorDOMus = XML::DOM::Parser->new();
my ($tree1, $tree2) = map { $majorDOMus->parse($_); } $doc1, $doc2;
for my $delta (@deltas) {
my $path = $delta->{'context'};
my @nodes;
( push @nodes, $tree1->findnodes($path) ) ?
1 :
( push @nodes, $tree2->findnodes($path) ) ?
1 :
print "\nThere is no node at '$path'\n";
if (@nodes) {
print "\nNODEVALUE(getNodeValue): ", $_->getNodeValue for @nodes;
print "\nNODEVALUE(getData): ", $_->XML::DOM::CharacterData::getData for @nodes;
print "\nTOSTRING: ", $_->toString, "\n" for @nodes;
}
}
1
2
3
4
Use of uninitialized value in print at ./TestGetValue line 31.
NODEVALUE(getNodeValue):
NODEVALUE(getData): city
TOSTRING: <city>Meatball</city>
|< 1 2 >| | 13 Einträge, 2 Seiten |