org.jmol.adapter.readers.xml
Class XmlReader
java.lang.Object
org.jmol.adapter.smarter.AtomSetCollectionReader
org.jmol.adapter.readers.xml.XmlReader
- Direct Known Subclasses:
- XmlArgusReader, XmlChem3dReader, XmlCmlReader, XmlOdysseyReader
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
Fields inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader |
ANGSTROMS_PER_BOHR, applySymmetryToBonds, atomSetCollection, desiredModelNumber, desiredSpaceGroupIndex, doApplySymmetry, filter, getHeader, ignoreFileSymmetryOperators, ignoreFileUnitCell, iHaveDesiredModel, iHaveSymmetryOperators, iHaveUnitCell, latticeCells, line, modelNumber, needToApplySymmetry, next, notionalUnitCell, prevline, primitiveLatticeVectors, ptLine, reader, readerName, spaceGroup |
Methods inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader |
addJmolScript, addPrimitiveLatticeVector, addSites, applySymmetry, checkLineForScript, checkLineForScript, clearLatticeParameters, discardLines, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilNonBlank, discardLinesUntilStartsWith, fillDataBlock, filterAtom, getElementSymbol, getStrings, getTokens, getTokens, getTokens, getTokensFloat, initialize, initialize, initializeCartesianToFractional, newAtomSet, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseToken, parseToken, parseToken, parseTokenNext, parseTrimmed, parseTrimmed, readLine, readLineTrimmed, setAtomCoord, setAtomCoord, setError, setFractionalCoordinates, setMOData, setSpaceGroupName, setSymmetryOperator, setUnitCell, setUnitCellItem |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parent
protected XmlReader parent
atom
protected Atom atom
implementedAttributes
java.lang.String[] implementedAttributes
keepChars
protected boolean keepChars
chars
protected java.lang.String chars
XmlReader
public XmlReader()
readAtomSetCollection
public AtomSetCollection readAtomSetCollection(java.io.BufferedReader reader)
- Specified by:
readAtomSetCollection
in class AtomSetCollectionReader
getXmlReader
private org.xml.sax.XMLReader getXmlReader()
allocateXmlReader14
private org.xml.sax.XMLReader allocateXmlReader14()
allocateXmlReaderAelfred2
private org.xml.sax.XMLReader allocateXmlReaderAelfred2()
processXml
private java.lang.Object processXml(org.xml.sax.XMLReader xmlReader)
throws java.lang.Exception
- Throws:
java.lang.Exception
parseReaderXML
protected void parseReaderXML(org.xml.sax.XMLReader xmlReader)
readAtomSetCollectionFromDOM
public AtomSetCollection readAtomSetCollectionFromDOM(java.lang.Object Node)
- Overrides:
readAtomSetCollectionFromDOM
in class AtomSetCollectionReader
processXml
private java.lang.Object processXml(netscape.javascript.JSObject DOMNode)
processStartElement
protected void processStartElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
java.util.HashMap atts)
setKeepChars
protected void setKeepChars(boolean TF)
processEndElement
protected void processEndElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)