John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

sub process_file ($) { my $filename= shift; my $twig= new XML::Twig(); print "filename: [$filename]\n"; $twig->parse ($filename); # $twig->print; }
I note that my filename is correct -- no stray \n's or other oddities. This is right out of the Synopsys of the documentation for Twig 3.00.

So what happens? I get

not well-formed at line 1, column 2, byte 2 at C:/Program Files/Langua +ges/Perl/site/lib/XML/Parser.pm line 168
Huh? —John

Replies are listed 'Best First'.
The Answer
by John M. Dlugosz (Monsignor) on Nov 04, 2001 at 11:51 UTC
    Well, it's a major bug in the documentation. It should be ->parsefile(), not ->parse(). Another example I tried had literal XML as the argument to parse(), and that led me to explore this more.

    If mirod is reading this, also note “...but you can also use a more perlish naming convention, using twig_print_outside_roots instead of twig_print_outside_roots...”

    —John