org.jmol.adapter.readers.xml

Class XmlReader

public class XmlReader extends AtomSetCollectionReader

A generic XML reader template -- by itself, does nothing. The actual readers are XmlCmlReader, XmlMolproReader (which is an extension of XmlCmlReader, XmlChem3dReader, and XmlOdysseyReader, which is wholely different. XmlReader takes all XML streams, whether from a file reader or from DOM. This class functions as a resolver, since it: (1) identifying the specific strain of XML to be handled, and (2) passing the responsibility on to the correct format-specific XML readers. There are parallel entry points and handler methods for reader and DOM. Each format-specific XML reader then assigns its own handler to manage the parsing of elements. In addition, this class handles generic XML tag parsing. XmlReader.JmolXmlHandler extends DefaultHandler is the generic interface to both reader and DOM element parsing. XmlCmlReader extends XmlReader and is where I'd like Andrew to take charge. XmlCmlReader.CmlHandler extends XmlReader.JmolXmlHandler is generic XmlMolproReader extends XmlCmlReader. If you feel like expanding on that, feel free. XmlMolproReader.MolprolHandler extends XmlCmlReader.CmlHandler adds Molpro-specific XML tag processing XmlChem3dReader extends XmlReader. That one is simple; no need to expand on it at this time. XmlChem3dReader.Chem3dHandler extends XmlReader.JmolXmlHandler is generic XmlOdysseyReader extends XmlReader. That one is simple; no need to expand on it at this time. XmlOdysseyReader.OdysseyHandler extends XmlReader.JmolXmlHandler is generic Note that the tag processing routines are shared between SAX and DOM processors. This means that attributes must be transformed from either Attributes (SAX) or JSObjects (DOM) to HashMap name:value pairs. This is taken care of in JmolXmlHandler for all readers. TODO 27/8/06: Several aspects of CifReader are NOT YET implemented here. These include loading a specific model when there are several, applying the symmetry, and loading fractional coordinates. [DONE for CML reader 2/2007 RMH] The DOM reader is NOT CHECKED OVER, and I do not think that it supports reading characters between start/end tags: characters If you work on this, please read formats other than CML into DOM so that we can see that that works as well. Test files: molpro: vib.xml odyssey: water.xodydata cml: a wide variety of files in data-files. Feel free to prune if some are not of use. -Bob Hanson
Nested Class Summary
static classXmlReader.DummyResolver
classXmlReader.JmolXmlHandler
Field Summary
protected Atomatom
protected Stringchars
String[]implementedAttributes
protected booleankeepChars
protected XmlReaderparent
Method Summary
XMLReaderallocateXmlReader14()
XMLReaderallocateXmlReaderAelfred2()
XMLReadergetXmlReader()
protected voidparseReaderXML(XMLReader xmlReader)
protected voidprocessEndElement(String uri, String localName, String qName)
protected voidprocessStartElement(String namespaceURI, String localName, String qName, HashMap atts)
ObjectprocessXml(XMLReader xmlReader)
ObjectprocessXml(JSObject DOMNode)
AtomSetCollectionreadAtomSetCollection(BufferedReader reader)
AtomSetCollectionreadAtomSetCollectionFromDOM(Object Node)
protected voidsetKeepChars(boolean TF)

Field Detail

atom

protected Atom atom

chars

protected String chars

implementedAttributes

String[] implementedAttributes

keepChars

protected boolean keepChars

parent

protected XmlReader parent

Method Detail

allocateXmlReader14

private XMLReader allocateXmlReader14()

allocateXmlReaderAelfred2

private XMLReader allocateXmlReaderAelfred2()

getXmlReader

private XMLReader getXmlReader()

parseReaderXML

protected void parseReaderXML(XMLReader xmlReader)

processEndElement

protected void processEndElement(String uri, String localName, String qName)

processStartElement

protected void processStartElement(String namespaceURI, String localName, String qName, HashMap atts)

processXml

private Object processXml(XMLReader xmlReader)

processXml

private Object processXml(JSObject DOMNode)

readAtomSetCollection

public AtomSetCollection readAtomSetCollection(BufferedReader reader)

readAtomSetCollectionFromDOM

public AtomSetCollection readAtomSetCollectionFromDOM(Object Node)

setKeepChars

protected void setKeepChars(boolean TF)