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?


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

In reply to XML::LibXML complains by Skeeve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.