sax

J

JP

Hi, i'm having small problem with sax2,i'm trying to parse "doctype"
elements from my xml file, this might be more sax issue than ruby, here's
the code:


require 'rexml/parsers/sax2parser'
require 'rexml/SAX2Listener'
include REXML

class SaxListener
include SAX2Listener
end

listener1 = SaxListener.new
parser = Parsers::SAX2Parser.new( File.new(
"f:\\data2\\mloy\\out\\uusinnat\\testindex.xml" ) )
parser.listen( %{ doctype }, listener1 )
parser.parse




now what i get is this:

f:/ruby/lib/ruby/1.8/rexml/parsers/sax2parser.rb:84:in `parse': undefined
method `start_document' for " doctype ":String (NoMethodError)
from f:/ruby/lib/ruby/1.8/rexml/parsers/sax2parser.rb:83:in `parse'
from F:/ruby/omat/sax2test.rb:15


how do you define start_document (and other mandatory ones of course) method
for some element?


Regards,

JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top