XmlReader
Date: 2019-10-22

org.jmol.adapter.readers.xml

## Class XmlReader

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

- All Implemented Interfaces:
    javajs.api.GenericLineReader
  Direct Known Subclasses:
    XmlArgusReader, XmlChem3dReader, XmlCmlReader, XmlMagResReader, XmlOdysseyReader, XmlQEReader, XmlVaspReader, XmlXsdReader

      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. 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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private class` | `XmlReader.NVPair`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Atom` | `atom`
    `private java.lang.Object[]` | `attArgs`
    `private java.lang.Object[]` | `attribs`
    `java.util.Map<java.lang.String,java.lang.String>` | `atts`
    `protected Bond` | `bond`
    `protected javajs.util.SB` | `chars`
    `private java.lang.Object[]` | `domObj`
    `protected boolean` | `keepChars`
    `private java.lang.Object[]` | `nullObj`
    `protected XmlReader` | `parent`

    - ### Fields inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader

      `addedData, addedDataKey, addVibrations, allowPDBFilter, ANGSTROMS_PER_BOHR, applySymmetryToBonds, asc, baseAtomIndex, binaryDoc, bsFilter, bsModels, calculationType, continuing, debugging, desiredModelNumber, desiredSpaceGroupIndex, desiredVibrationNumber, doApplySymmetry, doCentralize, doCheckUnitCell, doConvertToFractional, doPackUnitCell, doProcessLines, doReadMolecularOrbitals, dssr, fileName, fileOffset, filePath, fileScaling, fillRange, filter, filterHetero, fixJavaFloat, forcePacked, getHeader, haveAtomFilter, haveModel, havePartialChargeFilter, htParams, ignoreFileSpaceGroupName, ignoreFileSymmetryOperators, ignoreFileUnitCell, ignoreStructure, iHaveFractionalCoordinates, iHaveSymmetryOperators, iHaveUnitCell, isBinary, isConcatenated, isDSSP1, isFinalized, isMolecular, isPrimitive, isSequential, isTrajectory, latticeCells, latticeScaling, latticeType, line, lstNCS, matUnitCellOrientation, modDim, modelNumber, ms, mustFinalizeModelSet, next, out, packingError, prevline, primitiveToCrystal, ptLine, ptSupercell, reader, readerName, requiresBSFilter, reverseModels, rotateHexCell, sgName, stateScriptVersionInt, strSupercell, symmetry, templateAtomCount, thisBiomolecule, trajectorySteps, unitCellOffset, unitCellParams, useAltNames, useFileModelNumbers, validation, vibrationNumber, vibsFractional, vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XmlReader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applySymmetryAndSetTrajectory()`
    `(package private) java.lang.Object` | `createDomNodeJS(java.lang.String id, java.lang.Object data)` totally untested, probably useless
    `void` | `endDocument()`
    `private java.lang.String` | `fixLocal(java.lang.String name)`
    `private void` | `getDOMAttributesA(java.lang.Object[] attributes)`
    `protected void` | `initCML()`
    `void` | `initializeReader()`
    `private java.lang.Object` | `jsObjectCall(java.lang.Object[] jsObject, java.lang.String method, java.lang.Object[] args)`
    `private java.lang.Object` | `jsObjectGetMember(java.lang.Object[] jsObject, java.lang.String name)`
    `private java.lang.String` | `parseXML()`
    `protected void` | `processDOM(java.lang.Object DOMNode)`
    `(package private) void` | `processEndElement(java.lang.String localName)`
    `protected void` | `processStartElement(java.lang.String localName, java.lang.String nodeName)`
    `protected void` | `processXml(XmlReader parent, java.lang.Object saxReader)`
    `protected void` | `processXml2(XmlReader parent, java.lang.Object saxReader)`
    `private java.lang.String` | `selectReaderAndGo(java.lang.Object saxReader)`
    `protected void` | `setKeepChars(boolean TF)`
    `private void` | `setMyError(java.lang.String err)`
    `private void` | `walkDOMTree()`

    - ### Methods inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader

      `addAtomXYZSymName, addExplicitLatticeVector, addJmolScript, addSites, addSiteScript, appendLoadNote, appendUunitCellInfo, applySymTrajASCR, 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, finalizeSubclassReader, finalizeSubclassSymmetry, forceSymmetry, fractionalizeCoordinates, getElementSymbol, getFilter, getFortranFormatLengths, getInterface, getNewSymmetry, getStrings, getSymmetry, getTokens, getTokensFloat, initializeSymmetry, initializeSymmetryOptions, initializeTrajectoryFile, isLastModel, newAtomSet, parseFloat, parseFloatRange, parseFloatStr, parseInt, parseIntAt, parseIntRange, parseIntStr, 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, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem, setup, setupASCR`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### atom

          protected Atom atom

    - #### bond

          protected Bond bond

    - #### parent

          protected XmlReader parent

    - #### atts

          public java.util.Map<java.lang.String,java.lang.String> atts

    - #### keepChars

          protected boolean keepChars

    - #### chars

          protected javajs.util.SB chars

    - #### domObj

          private java.lang.Object[] domObj

    - #### attribs

          private java.lang.Object[] attribs

    - #### attArgs

          private java.lang.Object[] attArgs

    - #### nullObj

          private java.lang.Object[] nullObj

  - ### Constructor Detail

    - #### XmlReader

          public XmlReader()

  - ### Method Detail

    - #### initializeReader

          public void initializeReader()
                                throws java.lang.Exception

      Overrides:
        `initializeReader` in class `AtomSetCollectionReader`
      Throws:
        `java.lang.Exception`

    - #### initCML

          protected void initCML()

    - #### setMyError

          private void setMyError(java.lang.String err)

    - #### parseXML

          private java.lang.String parseXML()

    - #### selectReaderAndGo

          private java.lang.String selectReaderAndGo(java.lang.Object saxReader)

    - #### processXml

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

      Parameters:
        `parent` -
        `saxReader` -
      Throws:
        `java.lang.Exception`

    - #### processXml2

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

      Throws:
        `java.lang.Exception`

    - #### createDomNodeJS

          java.lang.Object createDomNodeJS(java.lang.String id,
                                           java.lang.Object data)

      totally untested, probably useless
      Parameters:
        `id` -
        `data` -
      Returns:
        dom object

    - #### applySymmetryAndSetTrajectory

          public void applySymmetryAndSetTrajectory()

      Overrides:
        `applySymmetryAndSetTrajectory` in class `AtomSetCollectionReader`

    - #### processDOM

          protected void processDOM(java.lang.Object DOMNode)

      Overrides:
        `processDOM` in class `AtomSetCollectionReader`

    - #### processStartElement

          protected void processStartElement(java.lang.String localName,
                                             java.lang.String nodeName)

      Parameters:
        `localName` -
        `nodeName` - TODO

    - #### setKeepChars

          protected void setKeepChars(boolean TF)

    - #### processEndElement

          void processEndElement(java.lang.String localName)

      Parameters:
        `localName` -

    - #### walkDOMTree

          private void walkDOMTree()

    - #### fixLocal

          private java.lang.String fixLocal(java.lang.String name)

    - #### getDOMAttributesA

          private void getDOMAttributesA(java.lang.Object[] attributes)

    - #### jsObjectCall

          private java.lang.Object jsObjectCall(java.lang.Object[] jsObject,
                                                java.lang.String method,
                                                java.lang.Object[] args)

      Parameters:
        `jsObject` -
        `method` -
        `args` -
      Returns:
        object

    - #### jsObjectGetMember

          private java.lang.Object jsObjectGetMember(java.lang.Object[] jsObject,
                                                     java.lang.String name)

    - #### endDocument

          public void endDocument()