Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
Previously I had used (long, long time ago) XML::Twig for parsing XML. Or XML::Simple.
Now I read that XML::Simple shouldn't be used in new code and so I wanted to try the named alternative XML::LibXML.
But I already failed with the simplest code:
use strict; use warnings; use XML::LibXML; my $doc = XML::LibXML->load_xml( location => shift, validation => 0, ); print "Done\n"; use Data::Dumper; print Dumper $doc;
When I leave out the DOCTYPE, it seems to parse, but as soon as I have
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
my script stops with:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd:1: parser error : Co +ntent error in the external subset HTTP/1.0 500 Server Error
I wouldn't want to remove the doctype, so I'm wondering what could be wrong here. And is there a way to make the parser NOT go out and retrieve the DTD?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::LibXML complains
by ikegami (Patriarch) on Jun 06, 2014 at 16:51 UTC | |
|
Re: XML::LibXML complains
by Skeeve (Parson) on Jun 06, 2014 at 13:52 UTC | |
by Anonymous Monk on Sep 05, 2017 at 10:37 UTC | |
|
Re: XML::LibXML complains
by taint (Chaplain) on Jun 06, 2014 at 14:07 UTC |