in reply to emdash problems with XML::Simple

What parser is your XML::Simple using? Try using XML::Parser instead.
local $XML::Simple::PREFERRED_PARSER = 'XML::Parser';

Replies are listed 'Best First'.
Re^2: emdash problems with XML::Simple
by nglenn (Beadle) on Aug 26, 2010 at 19:58 UTC

    Wow! That got rid of my longtime error. I never would have thought of that in a million years. I thought XML::Simple always used XML::Parser.

    It still does something I don't expect thought... 'table'=>undef is in the Dumper printout. Why isn't it reading it properly?

      "XML::Simple will default to using a SAX parser if one is available or XML::Parser if SAX is not available."

      You probably ended up using the PurePerl SAX parser which is/was buggy when it came to encodings. XML::Parser is by far the fastest existing backend for XML::Simple, according to my benchmarks a year ago.

      XML::Simple removes the root by default.

      my $tree = { table => {} }; $tree->{table} = $xml->XMLin($fileName, ForceArray => ['map'], KeyAttr => [] ) ->{table};
      should be
      my $tree = $xml->XMLin($fileName, ForceArray => [qw( map )], KeyAttr => {}, KeepRoot => 1, );

        Makes sense. Except, if Parser is so much better than SAX why is Simple still using SAX as a default...