Re: XML::LibXML hangs on document w/ DTD
Michael Ludwig <[email protected]> Tue, 15 Nov 2011 20:08:35 +0100
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <20111115190835.GA4556@Dago> |
Vaclav Barta schrieb am 15.11.2011 um 19:33 (+0100): > Hi, > > in response to a user bug report, I tried testing my module > (XML::DifferenceMarkup) again and found that its testsuite hangs on my > machine :-( - which isn't necessarily anybody else's problem, :-) but > I've isolated it to a test case that isn't using XML::DifferenceMarkup > at all: Well done! It hangs on everybody's machine, that's the W3C's way of telling people not to download the DTD from their servers but use a local copy instead. > my $b = $parser->load_xml(string => <<'BDOC'); > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > </html> > BDOC Try load_html, works for me (but see below): use strict; use warnings; use XML::LibXML; print "$_\n" for $XML::LibXML::VERSION, XML::LibXML::LIBXML_DOTTED_VERSION, XML::LibXML::LIBXML_VERSION, XML::LibXML::LIBXML_RUNTIME_VERSION; my %opt = ( # load_ext_dtd => 0, # validation => 0, # no_network => 1, # recover => 1, ); my $parser = XML::LibXML->new( %opt ); my $b = $parser->load_html(string => <<'BDOC'); # load_xml/load_html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html></html> BDOC print "parsed b\n"; > prints "parsed a" but hangs when parsing b... It could still be a > problem with my local configuration (although AFAIK I didn't do > anything special to resolve DTDs) The doc for XML::LibXML::Parser says it'll do so by default. Check the load_ext_dtd option. http://search.cpan.org/dist/XML-LibXML/ The fact that load_xml does not seem to honour the load_ext_dtd option looks like a bug me. But I might be wrong. > but xmllint handles the "b" doc fine - adds xml declaration but > doesn't complain about anything and ends normally. libxml2 is 2.7.8, > XML::LibXML 1.70 (I also tried 1.88, with the same result) on gentoo. My versions are: 1.70 2.7.7 20707 20708 -- Michael Ludwig _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs