[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

JP

4/6/2006 2:52:00 PM

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