Egon, take a look at the code. I probably didn't make it clear from that message, but I think I agree totally with you, and I think I've implemented it that way; I hope it's clear in the code.
What I did was to tease out the the distinction between CML and XML. This allowed abstraction to other XML types. Each type should ultimately be readable from DOM or file. This capability is encoded in XmlReader as a superclass and is transparent to the actual implementation subclasses. Basically, XmlReader is an XML resolver. Since the resolver itself has to take on all the operations of an XML reader, I have named its class XmlReader, and the following are extensions of that: XmlCmlReader XmlArgusReader XmlOdysseyReader XmlMolproReader In this way, as I think you desire, each reader has its own class, each extending XmlReader. In fact, XmlMolProReader implements a particular variant of CML, so it is an extension of XmlCmlReader. XmlReader by itself does nothing except run through the XML, using either DOM or the SAX reader, as appropriate. XmlReader has two methods that serve to resolve what kind of XML we are dealing with. These are String getXmlType(BufferedReader reader) and String getXmlType(JSObject DOMNode) If the XML can be resolved to a specific type, either by name space or by reading the header of the file or by reading a local name, then control is passed to one of the readers, initializing them in either DOM or SAX mode. If the type is not resolvable, then control continues with the default reader, XmlReader, and at least allows for debugging if we want to do that. The methods processStartElement and processEndElement are empty, but we could add Logger.debug messages if desired. So I think it's pretty clean. What I need now is for one of the Andrews (Walker is the postdoc?) to run with just the CML reader. Bob > On Friday 01 September 2006 08:38, Bob Hanson wrote: >> I've added an ArgusLab reader and also modified the CML variant. Toby >> and Andrew, if you have already started work on the CML reader, just >> take a look at what I did. There were problems with how the chars were >> being used, and I added a general method setKeepChars(boolean). I >> believe this will NOT work with DOM, so Toby, if you would please check >> out how DOM reads chars between tabs and fix this, that would be great. >> Basically, my idea is to set Jmol up to read any of these XML subtypes >> from DOM. > > Bob, I don't think it is a good idea to put combine readers for different > file > formats in one reader. This makes the code more complex, and likely allows > mixing formats if things are not written very carefully. I know splitting > them up generates some redundancy, but I think that might be better in > this > case. > > Egon > > -- > [EMAIL PROTECTED] > Cologne University Bioinformatics Center (CUBIC) > Blog: http://chem-bla-ics.blogspot.com/ > GPG: 1024D/D6336BA6 > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Jmol-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jmol-developers > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Jmol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-developers
