in reply to Re^2: emdash problems with XML::Simple
in thread emdash problems with XML::Simple

"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, );

Replies are listed 'Best First'.
Re^4: emdash problems with XML::Simple
by nglenn (Beadle) on Aug 28, 2010 at 03:14 UTC

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

      I said faster, not better. One downside of XML::Parser is that XML::Simple doesn't support namespaces when it parses using it. I don't know if there's any other differences.