From: Krister Johnson Date: 2007-05-06T17:40:56+09:00 Subject: Re: SAX2Parser, anyone? oh no. that really was it. (slaps forehead) thanks. krister On 5/6/07, Sylvain Joyeux wrote: > On Sunday 06 May 2007, Krister Johnson wrote: > > Hi guys. > > > > I'm trying to mine some info from wikipedia's xml dump. The code im > > using is as follows: > > > > require 'rexml/parsers/sax2parser' > > xml = > > REXML::Parsers:SAX2Parser.new(File.new('enwiki-20070402-pages-articles-1 > >.xml') ) > > > > i = 0 > > parser.listen(:characters, %w{title text}){|text| puts text} > > parser.parse > > > > Which is generating the error: > > xmlreap.rb:2: undefined method `new' for :SAX2Parser:Symbol > > (NoMethodError) > > This is a syntax error. You have written > REXML::Parsers:SAX2Parser.new() > which, I guess, is interpreted as > REXML::Parsers(:SAX2Parser.new()) > > but :SAX2Parser is a symbol, and there is no new method on it ... > You wanted (two ':') > REXML::Parsers::SAX2Parser.new() > > -- > Sylvain Joyeux > >