From: TAKAHASHI Masayoshi Date: 2001-03-07T02:37:16+09:00 Subject: [ruby-talk:12165] Re: NQXML: Pure Ruby XML parser (almost) Hi, Jim Menard wrote: > NQXML is a pure-Ruby XML parser that I'm writing from scratch. The "NQ" > stands for "Not Quite" because, among other things, it does not yet support > UTF-8 or UTF-16, ENTITY or DOCTYPE tags and the DOM parser isn't done yet. > The tokenizer and SAX parser are working. I wrote a patch. * install.rb: fix bug(? but I cannot install without this fix). * tokenizer.rb: ProcessingInstaruction -> ParserError * parserTest.rb: not bug, but can parse XML file if it uses DocType Decl(ignore 'not implemented' error). It can parse UTF-8 XML file in XMLParser's archive(index_u8.xml). # of cource, its UTF-8 support is not perfect (yet). TAKAHASHI 'Maki' Masayoshi E-mail: maki@open-news.com diff -ur nqxml.org/install.rb nqxml/install.rb --- nqxml.org/install.rb Wed Mar 7 01:37:20 2001 +++ nqxml/install.rb Wed Mar 7 01:38:46 2001 @@ -26,6 +26,6 @@ INSTALL_DIR = instdir() File.makedirs(INSTALL_DIR + '/' + LIBDIR) -Find.find(SOURCE_DIR).each { |f| +Find.find(SOURCE_DIR){ |f| File.install(f, INSTALL_DIR + "/" + f, 0644, true) if f =~ /.rb$/ } diff -ur nqxml.org/nqxml/tokenizer.rb nqxml/nqxml/tokenizer.rb --- nqxml.org/nqxml/tokenizer.rb Wed Mar 7 01:37:19 2001 +++ nqxml/nqxml/tokenizer.rb Wed Mar 7 02:00:33 2001 @@ -228,7 +228,7 @@ def nextEntityOrDoctype textUpTo('>', true) skipChar() # eat '>' - raise ProcessingInstruction.new('not yet implemented;' + + raise ParserError.new('not yet implemented;' + ' entity skipped') end diff -ur nqxml.org/parseTest.rb nqxml/parseTest.rb --- nqxml.org/parseTest.rb Wed Mar 7 01:37:20 2001 +++ nqxml/parseTest.rb Wed Mar 7 01:59:11 2001 @@ -15,8 +15,14 @@ begin # Don't do anything, just let parser run through the XML parser.each { | type, name, data | } - rescue - puts "ERROR: $!\n" + rescue NQXML::ParserError + if /not yet implemented/ =~ $! + retry + else + puts "ERROR: #{$!}",$@.join("\n") + end + rescue + puts "ERROR: #{$!}",$@.join("\n") end puts 'OK' end