From: Alan Chen Date: 2002-01-27T04:15:23+09:00 Subject: Re: REXML: stream parsing question On Sun, Jan 27, 2002 at 03:13:12AM +0900, Markus Jais wrote: > Hello, > > I have this piece of code: > > require "rexml/document" > include REXML > > class MyListener > def tag_start name, attrs > print "start name: ",name.strip, "\n" > print "start attrs: ",attrs, "\n" > end > def tag_end name > puts "end: ", name.strip, "\n" > end > > def text(text) > print "text: ", text.strip, "\n" > end > > def method_messing(methId) > puts methId.idname > end > end > ml = MyListener.new > Document.parse_stream(File.new("bla.xml"), ml) > > it works just fine: > but when I comment the > def text(text) > method out, I get the following error: > > /usr/local/lib/ruby/site_ruby/1.6/rexml/text.rb:76:in `parse_stream': > undefined method `text' for # (NameError) > from /usr/local/lib/ruby/site_ruby/1.6/rexml/element.rb:394:in > `parse_stream' > from /usr/local/lib/ruby/site_ruby/1.6/rexml/document.rb:179:in > `parse_stream' > from ./stream.rb:29 > > does anybody know what I did wrong. I thought it would jump into > "method_messing". > I have REXML 1.2.5 > > markus You have a typo on "method_messing". It should be method_missing. -- Alan Chen Digikata LLC http://digikata.com