[MacRuby-devel] [macruby] #108: Exception parsing XML file using REXML
macruby
ruby-noreply at macosforge.org
Mon Aug 4 09:41:22 PDT 2008
#108: Exception parsing XML file using REXML
----------------------------------+-----------------------------------------
Reporter: jon.lipsky at gmail.com | Owner: lsansonetti at apple.com
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Hi,
I am getting a "Can't modify immutable string" exception when trying to
parse an XML document using the streaming parser included with REXML. I
have created a sample script and sample XML file to reproduce the problem:
{{{
require "rexml/document"
require "rexml/streamlistener"
include REXML
class Reader
include StreamListener
def tag_start(a_name, a_attributes)
puts(a_name + " - " + a_attributes.to_s)
end
end
reader = Reader.new
file = File.open("test.xml",File::RDONLY)
Document.parse_stream(file, reader)
}}}
{{{
<?xml version="1.0" encoding="UTF-8"?>
<test>
</test>
}}}
Here is the stack trace that is generated:
{{{
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/rexml/parsers/baseparser.rb:260:in
`force_encoding': can't modify immutable string (RuntimeError)
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/rexml/parsers/baseparser.rb:260:in
`pull'
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/rexml/parsers/streamparser.rb:16:in
`parse'
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/rexml/document.rb:200:in
`parse_stream'
from /Development/personal/ruby/rbface/src/rb/rexml_test.rb:16:in
`<main>'
}}}
Thanks and best regards,
Jon...
--
Ticket URL: <https://www.macruby.org/trac/ticket/108>
macruby <http://macruby.org/>
More information about the MacRuby-devel
mailing list