[libxml-devel] [ libxml-Bugs-21546 ] SaxParser Crashes -- Null Pointer
noreply at rubyforge.org
noreply at rubyforge.org
Sat Nov 15 20:14:53 EST 2008
Bugs item #21546, was opened at 2008-08-12 19:26
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21546&group_id=494
Category: General
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nick Retallack (nickretallack)
Assigned to: Nobody (None)
Summary: SaxParser Crashes -- Null Pointer
Initial Comment:
Any xml document that contains a DTD causes SaxParser to crash.
Example:
require 'rubygems'
require 'libxml'
class Handler
def method_missing(method_name, *attributes, &block); end
end
parser = LibXML::XML::SaxParser.new
parser.filename = 'anything_with_a_dtd.xml'
parser.callbacks = Handler.new
puts parser.filename
parser.parse
result:
saxmltest.rb:12:in `parse': NULL pointer given (ArgumentError)
It seems I am not the only person having this problem.
http://rubyforge.org/pipermail/libxml-devel/2008-July/001042.html
----------------------------------------------------------------------
>Comment By: Charlie Savage (cfis)
Date: 2008-11-15 18:14
Message:
Hi Nick,
I think I've got this fixed - will be in the next release. Thanks for the report.
----------------------------------------------------------------------
Comment By: Andy Hauser (buggs)
Date: 2008-08-26 12:41
Message:
This bug is whitespace sensitive. Your test_doctype with the inline document does not start with an XML declaration, so it does not get triggered. Remove the whitespace before it and the bug appears. It seems otherwise it's not even parsing the data.
Here is complete program showing the bug:
require 'libxml'
class DocTypeCallback
include LibXML::XML::SaxParser::Callbacks
def on_start_element(element, attributes)
puts element
end
end
def test_doctype
xp = LibXML::XML::SaxParser.new
xp.callbacks = DocTypeCallback.new
xp.string = <<-EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Results SYSTEM "results.dtd">
<Results>
<a>a1</a>
</Results>
EOS
doc = xp.parse
end
test_doctype
----------------------------------------------------------------------
Comment By: Charlie Savage (cfis)
Date: 2008-08-20 02:29
Message:
Does the tc_sax_parser#test_doctype test work for you? That's copied directly from the link you mention, and works fine here. Does it work for you?
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21546&group_id=494
More information about the libxml-devel
mailing list