# Class CDXMLParser

java.lang.Object
org.jmol.adapter.readers.xml.CDXMLParser

public class CDXMLParser extends Object
A reader for CambridgeSoft CDXML files. For the full specification of CDX/CDXML, see https://iupac.github.io/IUPAC-FAIRSpec revvity site: https://support.revvitysignals.com/hc/en-us/articles/4408233129748-Where-is-the-ChemDraw-SDK-located Their link: https://web.archive.org/web/20221209095323/https://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx/ WayBack machine Overview: https://web.archive.org/web/20240000000000* /https://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx Partial archives: https://web.archive.org/web/20160911235313/http://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx/index.htm https://web.archive.org/web/20160310081515/http://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx/ https://web.archive.org/web/20100503174209/http://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx/ Unfortunately, there appears to be no single archive that has all the images, and so some of those are missing. for the full, detailed specification. Here we are just looking for simple aspects that could be converted to valid 2D MOL files, SMILES, and InChI. Fragments (such as CH2CH2OH) and "Nickname"-type fragments such as Ac and Ph, are processed correctly. But their 2D representations are pretty nuts. ChemDraw does not make any attempt to place these in reasonable locations. That said, Jmol's 3D minimization does a pretty fair job, and the default is to do that minimization. If minimization and addition of H is not desired, use FILTER "NOH" or FILTER "NO3D" XmlChemDrawReader also serves as the reader for binary CDX files, as CDXReader subclasses this class. See that class for details.

Author:
  hansonr@stolaf.edu

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`CDXMLParser.CDXReaderI`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected BS`
`bsAtoms`
`protected BS`
`bsBonds`
`Map<String, org.jmol.adapter.readers.xml.CDXMLParser.CDNode>`
`mapCloned`
`protected CDXMLParser.CDXReaderI`
`rdr`

## Constructor Summary

Constructors
Constructor
Description
`CDXMLParser(CDXMLParser.CDXReaderI reader)`

## Method Summary

Modifier and Type
Method
Description
`void`
`finalizeParsing()`
`org.jmol.adapter.readers.xml.CDXMLParser.CDBond`
`getBond(org.jmol.adapter.readers.xml.CDXMLParser.CDNode a, org.jmol.adapter.readers.xml.CDXMLParser.CDNode b)`
`static String`
`getBondKey(int atomIndex1, int atomIndex2)`
`String`
`nextID()`
`void`
`processStartElement(String localName, Map<String,String> atts)`
`void`
`setAtom(String key, Map<String,String> atts)`
Set the 2D or pseudo-3D coordinates of the atoms.

### Methods inherited from class Object

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

## Field Details

### bsAtoms

protected BS bsAtoms

### bsBonds

protected BS bsBonds

### rdr

protected CDXMLParser.CDXReaderI rdr

### mapCloned

public Map<String, org.jmol.adapter.readers.xml.CDXMLParser.CDNode> mapCloned

## Constructor Details

### CDXMLParser

public CDXMLParser(CDXMLParser.CDXReaderI reader)

## Method Details

### processStartElement

public void processStartElement(String localName, Map<String,String> atts)

### nextID

public String nextID()

### getBondKey

public static String getBondKey(int atomIndex1, int atomIndex2)

### getBond

public org.jmol.adapter.readers.xml.CDXMLParser.CDBond getBond(org.jmol.adapter.readers.xml.CDXMLParser.CDNode a, org.jmol.adapter.readers.xml.CDXMLParser.CDNode b)

### setAtom

public void setAtom(String key, Map<String,String> atts)
Set the 2D or pseudo-3D coordinates of the atoms. ChemDraw pseudo-3D is just a z-layering of chunks of the molecule. Nothing really useful. These coordinates are ignored if there are any atoms also with 2D coordinates or for FILTER "NO3D". So, pretty much, the z coordinates are never used.

Parameters:
  `key` -
  `atts` -

### finalizeParsing

public void finalizeParsing()