Even if XML::Parser.default_load_external_dtd is set to false the parser loads the DTD, see test script:

require 'xml/libxml'

xml = <<TEST
<test><title>T1</title></test>
TEST

xmldtd = <<TEST
<!DOCTYPE test PUBLIC "-//TEST" "test.dtd" []>
<test><title>T1</title></test>
TEST

XML::Parser.default_load_external_dtd = false

puts XML::Document.string(xml).root.find_first('title')
puts XML::Document.string(xmldtd).root.find_first('title')


This generates the output:

<title>T1</title>
I/O warning : failed to load external entity "test.dtd"
<!DOCTYPE test PUBLIC "-//TEST" "test.dtd" []>
                                              ^
<title>T1</title>

I can suppress the warnings with default_warnings=false but this is not the issue, the parser still attempts to load the DTD. In the case above the DTD does not exist so no harm is done. In another test case I have the DTD does exist but should not be loaded, in this case the bug makes it impossible to work with the XML.


--Paul
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to