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

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' );

Replies are listed 'Best First'.
Re^7: Comparison of XML files ignoring ordering of child elements
by haukex (Archbishop) on Jan 30, 2019 at 08:42 UTC
    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"?>.