in reply to XML::Dumper: Nifty or Naughty?
What do you see if you compare $rexmlified and $ssxmlified yourself? They must look like simple textual xml don't they? You could try runnung it through the substitutions above and see where they differ.sub xml_compare { # ============================================================ =item * xml_compare( $xml1, $xml2 ) - Compares xml for content Compares two dumped Perl data structures (that is, compares the xml) f +or identity in content. Use this function rather than perl's built-in str +ing comparison, especially when dealing with perl data that is memory-loca +tion dependent (which pretty much means all references). This function wil +l return true for any two perl data that are either deep clones of each other, or identical. This method is exported by default. =cut # ------------------------------------------------------------ my $xml1 = shift; my $xml2 = shift; $xml1 =~ s/(<[^>]*)\smemory_address="\dx[A-Za-z0-9]+"([^<]*>)/$1$2 +/g; $xml2 =~ s/(<[^>]*)\smemory_address="\dx[A-Za-z0-9]+"([^<]*>)/$1$2 +/g; $xml1 =~ s/(<[^>]*)\sdefined=\"false\"([^<]>)/$1$2/g; # For backwa +rds $xml2 =~ s/(<[^>]*)\sdefined=\"false\"([^<]>)/$1$2/g; # compatibil +ity $xml1 =~ s/<\?xml .*>//; # Ignore XML declaration $xml2 =~ s/<\?xml .*>//; $xml1 =~ s/<\!DOCTYPE perldata \[.*\]>//s; # Remove DTD $xml2 =~ s/<\!DOCTYPE perldata \[.*\]>//s; $xml1 =~ s/^\n//gm; # Remove empty newlines $xml2 =~ s/^\n//gm; return not( $xml1 cmp $xml2 ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: XML::Dumper: Nifty or Naughty?
by wufnik (Friar) on May 09, 2003 at 14:03 UTC | |
by wufnik (Friar) on May 09, 2003 at 14:20 UTC |