in reply to Re^4: Comparison of XML files ignoring ordering of child elements
in thread Comparison of XML files ignoring ordering of child elements

Thank you very much Ken! Need one more help, can you please show me how can I use this approach providing XMLs as input file to the Perl script. Thank You
  • Comment on Re^5: Comparison of XML files ignoring ordering of child elements

Replies are listed 'Best First'.
Re^6: Comparison of XML files ignoring ordering of child elements
by adikan123 (Novice) on Jan 30, 2019 at 07:05 UTC

    I am using below code to compare 2 different XML files but I am getting below error

    1..1 Entity: line 1: parser error : ParsePI: PI xm space expected <?xm="UTF-8"?> ^ # Looks like your test exited with 255 before it could output anything +.

    Please suggest me what can be wrong in the script.

    use strict; use warnings; use Test::More tests => 1; use Test::XML::Ordered 'is_xml_ordered'; my $parser1 = XML::LibXML->new(); my $expected = $parser1->parse_file( $ARGV[0] ); my $parser2 = XML::LibXML->new(); my $actual = $parser2->parse_file( $ARGV[1] ); is_xml_ordered( [string => $actual], [string => $expected], {}, 'Test $got_good' );
      Entity: line 1: parser error : ParsePI: PI xm space expected <?xm="UTF-8"?> ^
      Please suggest me what can be wrong in the script.

      From the error message it seems pretty clear to me that your input file is malformed. A typical first line of an XML file would be <?xml version="1.0" encoding="UTF-8"?>.