Re: Can XML::Simple not load the external subset?
Grant McLean <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2010-01-27 at 15:58 +1300, Jensen, John T wrote: > I am trying to use XML::Simple because I can just slurp my data into a > hash. However, the xml file is filled with entities pointing to > external xml files. It appears that XML::Simple cannot access those. XML::Simple doesn't actually parse XML - it delegates that to an installed parser module. Some of the parsers support external entities some don't. It sounds like the parser you're using falls into the latter category. If you have XML::SAX installed, then XML::Simple will use the SAX API and it will get whichever SAX parser is configured as the default on your system. If you installed XML::SAX but didn't explicitly install a SAX parser module then you're probably using the XML::SAX::PurePerl parser. This isn't a good idea because it's lacking in features and even when it does work it's slow. In my tests, XML::SAX::Expat and XML::SAX::ExpatXS both seemed to support the external entities. XML::LibXML::SAX seemed to duplicate the contents of the external entities - which is mighty odd. So in short, install XML::SAX::Expat (or if you have a compiler available, install XML::SAX::ExpatXS) and you should be fine. Having said all of that, I really would recommend using XML::LibXML instead of XML::Simple, as per this article: http://www.perlmonks.org/index.pl?node_id=490846 Cheers Grant _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs