# Class XmlReader

java.lang.Object
org.jmol.adapter.smarter.AtomSetCollectionReader
org.jmol.adapter.readers.xml.XmlReader

All Implemented Interfaces:
  `GenericLineReader`

Direct Known Subclasses:
  `XmlArgusReader, XmlCdxReader, XmlChem3dReader, XmlCmlReader, XmlMagResReader, XmlOdysseyReader, XmlQEReader, XmlVaspReader, XmlXsdReader`

public abstract 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. 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. XmlHandler extends DefaultHandler is the generic interface to both reader and DOM element parsing. XmlCmlReader extends XmlReader XmlMolproReader extends XmlCmlReader. If you feel like expanding on that, feel free. XmlChem3dReader extends XmlReader. That one is simple; no need to expand on it at this time. XmlOdysseyReader extends XmlReader. That one is simple; no need to expand on it at this time. 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 Hashtable 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] Test files: molpro: vib.xml odyssey: water.xodydata cml: a wide variety of files in data-files. -Bob Hanson

## Field Summary

Fields
Modifier and Type
Field
Description
`Map<String,String>`
`atts`
`protected SB`
`chars`
`protected boolean`
`keepChars`
`XmlReader`
`parent`
`protected Atom`
`thisAtom`

### Fields inherited from class AtomSetCollectionReader

`addedData, addedDataKey, addVibrations, allow_a_len_1, allowPDBFilter, ANGSTROMS_PER_BOHR, applySymmetryToBonds, asc, baseAtomIndex, baseBondIndex, binaryDoc, bsFilter, bsModels, calculationType, CELL_TYPE_CONVENTIONAL, CELL_TYPE_PRIMITIVE, CELL_TYPE_SUPER, cellSlop, centroidPacked, checkNearAtoms, continuing, debugging, desiredModelNumber, desiredSpaceGroupIndex, desiredVibrationNumber, doApplySymmetry, doCentralize, doCentroidUnitCell, doCheckUnitCell, doConvertToFractional, doPackUnitCell, doProcessLines, doReadMolecularOrbitals, dssr, fileName, fileOffset, filePath, fileScaling, fillRange, filter, filterAllHetero, filterCased, filteredPrecision, filterHetero, floatifyJavaDouble, forcePacked, getHeader, haveAtomFilter, haveModel, havePartialChargeFilter, htParams, ignoreFileSpaceGroupName, ignoreFileSymmetryOperators, ignoreFileUnitCell, ignoreStructure, iHaveFractionalCoordinates, iHaveSymmetryOperators, iHaveUnitCell, is2D, isBinary, isConcatenated, isDSSP1, isFinalized, isMolecular, isPrimitive, isSequential, isSUPERCELL, isTrajectory, latticeCells, latticeScaling, latticeType, line, lowPrecision, lstNCS, matUnitCellOrientation, merging, modDim, modelNumber, ms, mustFinalizeModelSet, next, noHydrogens, noMinimize, noPack, optimize2D, out, paramsCentroid, paramsLattice, precision, prevline, primitiveToCrystal, ptLine, ptSupercell, reader, readerName, requiresBSFilter, reverseModels, rotateHexCell, sgName, slabXY, stateScriptVersionInt, strSupercell, symmetry, templateAtomCount, thisBiomolecule, trajectorySteps, ucItems, unitCellOffset, unitCellParams, useAltNames, useFileModelNumbers, validation, vibrationNumber, vibsFractional, vwr`

## Constructor Summary

Constructors
Constructor
Description
`XmlReader()`

## Method Summary

Modifier and Type
Method
Description
`void`
`applySymmetryAndSetTrajectory()`
`void`
`endDocument()`
`protected void`
`finalizeSubclassReader()`
`void`
`initializeReader()`
//////////// file reader option //////////////
`protected BufferedReader`
`previewXML(BufferedReader reader)`
An opportunity to fix XML (nmrML issues)
`protected void`
`processDOM(Object DOMNode)`
//////////// DOM option //////////////
`protected void`
`processStartElement(String localName, String nodeName)`
`protected void`
`processXml(XmlReader parent, Object saxReader)`
`protected void`
`processXml2(XmlReader parent, Object saxReader)`
`protected void`
`setKeepChars(boolean TF)`

### Methods inherited from class AtomSetCollectionReader

`addAtomXYZSymName, addExplicitLatticeVector, addJmolScript, addMoreUnitCellInfo, addSites, addSiteScript, appendLoadNote, applySymTrajASCR, checkAndRemoveFilterKey, checkCurrentLineForScript, checkFilterKey, checkLastModel, checkLine, checkLineForScript, clearUnitCell, cloneLastAtomSet, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilContains2, discardLinesUntilNonBlank, discardLinesUntilStartsWith, discardPreviousAtoms, doGetModel, doGetVibration, doPreSymmetry, fill3x3, fillDataBlock, fillDataBlockFixed, fillFloatArray, fillFrequencyData, filterAtom, filterReject, finalizeMOData, finalizeModelSet, finalizeReaderASCR, finalizeSubclassSymmetry, fixDoubleA, fixFloatA, fixFloatPt, forceSymmetry, fractionalizeCoordinates, getElementSymbol, getFilter, getFilterWithCase, getFortranFormatLengths, getInterface, getPackingRangeValue, getStrings, getSymmetry, getTokens, getTokensFloat, initializeSymmetry, initializeSymmetryOptions, initializeTrajectoryFile, isLastModel, newAtomSet, parseFloat, parseFloatRange, parseFloatStr, parseInt, parseIntAt, parseIntRange, parseIntStr, parsePrecision, parseToken, parseTokenNext, parseTokenRange, parseTokenStr, processBinaryDocument, rd, read3Vectors, readDataObject, readLines, readNextLine, rejectAtomName, RL, set2D, setAtomCoord, setAtomCoordScaled, setAtomCoordTokens, setAtomCoordXYZ, setChainID, setElementAndIsotope, setFilter, setFilterAtomTypeStr, setFractionalCoordinates, setIsPDB, setLoadNote, setModelPDB, setPrecision, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem, setup, setupASCR, warnSkippingOperation`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### thisAtom

protected Atom thisAtom

### parent

public XmlReader parent

### atts

public Map<String,String> atts

### keepChars

protected boolean keepChars

### chars

protected SB chars

## Constructor Details

### XmlReader

public XmlReader()

## Method Details

### initializeReader

public void initializeReader() throws Exception
//////////// file reader option //////////////

Overrides:
  `initializeReader` in class `AtomSetCollectionReader`
Throws:
  `Exception`

### processXml

protected void processXml(XmlReader parent, Object saxReader) throws Exception

Parameters:
  `parent` -
  `saxReader` -
Throws:
  `Exception`

### processXml2

protected void processXml2(XmlReader parent, Object saxReader) throws Exception

Throws:
  `Exception`

### previewXML

protected BufferedReader previewXML(BufferedReader reader) throws IOException
An opportunity to fix XML (nmrML issues)

Parameters:
  `reader` -
Returns:
  reader or a repaired reader
Throws:
  `IOException`

### applySymmetryAndSetTrajectory

public void applySymmetryAndSetTrajectory()

Overrides:
  `applySymmetryAndSetTrajectory` in class `AtomSetCollectionReader`

### processDOM

protected void processDOM(Object DOMNode)
//////////// DOM option //////////////

Overrides:
  `processDOM` in class `AtomSetCollectionReader`
Parameters:
  `DOMNode` -

### processStartElement

protected void processStartElement(String localName, String nodeName)

Parameters:
  `localName` -
  `nodeName` - TODO

### setKeepChars

protected void setKeepChars(boolean TF)

### endDocument

public void endDocument()

### finalizeSubclassReader

protected void finalizeSubclassReader() throws Exception

Overrides:
  `finalizeSubclassReader` in class `AtomSetCollectionReader`
Throws:
  `Exception`