From: TAKAHASHI Masayoshi Date: 2001-11-28T20:10:56+09:00 Subject: [ruby-talk:26765] Re: OASIS test change suggestion Hi, Jim Menard wrote: > I would like to suggest a change in the OASIS test script. > > Instead of sending a String containing XML to each parser, please send a > File object. This way, the parser can follow external references to other > files. If you slurp the XML into the string and feed NQXML the string, it > has no way of knowing where the file resides and it can't follow the > external reference. Hmmm... I can change the script. But I think it does not make NQXML more conformant as non-validating processor, because non-validating processor does not have to read external entities; it must read only document entity (but non-validating processor may read other external entities). Moreover, IMHO, NQXML (and other parsers) should have something like: a) setBase method in XMLParser, and b) resolveEntity method in SAX's EntityResolver class. a) is to set base URI which is not original file's location. For example, you may parse local file which is got from other machine by HTTP or FTP. #(example I imagine) parser = NQXML::StreamingParser.new(File.open(file, 'r')) parser.setBaseURI(other_uri) parser.each { |entity| .... Instead of setBase, you can modify NQXML::StreamingParser::new method, like `def initialize(stringOrReadable, baseURI = nil)' b) is used to define entity resolver by yourself. You can see a sample in below URL. http://www.ibiblio.org/xml/books/xmljava/chapters/ch07s02.html#LocalXHTML.java Anyway, resolving entity references is difficult(at least for me). In fact, even SAX 2.0 is not enough to handle it, so EntityResolver2 is proposed in SAX2.0 extention 1.1. http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html # I don't follow up sax-devel ML, so maybe I make a mistake. Hope this helps, p.s. When NQXML becomes to have conformance with XML 1.0 Rec, do you rename it 'Quite XML parser'? ;-) TAKAHASHI Masayoshi (maki@inac.co.jp)