Class AbstractCMLDocumentImpl

All Implemented Interfaces:
AbstractCMLDocument, CMLNode, PMRDocument, Document, Node

public class AbstractCMLDocumentImpl extends PMRDocumentImpl implements AbstractCMLDocument
The base class for any CML Document objects
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Field Details

    • DEFAULT_OUTPUT_ENCODING

      public static final String DEFAULT_OUTPUT_ENCODING
      Description of the Field
      See Also:
    • DEFAULT_OUTPUT_DTD

      public static final String DEFAULT_OUTPUT_DTD
      Description of the Field
      See Also:
    • version

      protected String version
    • arraySyntax

      protected boolean arraySyntax
    • debug

      protected boolean debug
  • Constructor Details

    • AbstractCMLDocumentImpl

      public AbstractCMLDocumentImpl()
      create an Empty Document. probably should only be used when we need an instance of this class for introspection
    • AbstractCMLDocumentImpl

      protected AbstractCMLDocumentImpl(Document doc)
      Constructor for the AbstractCMLDocumentImpl object
      Parameters:
      doc - Description of the Parameter
  • Method Details

    • transferOwnerDocument

      public static AbstractBase transferOwnerDocument(AbstractCMLDocument doc, AbstractBase elem)
    • createSubclassedElement

      public Element createSubclassedElement(String tagName)
      Description of the Method
      Specified by:
      createSubclassedElement in interface AbstractCMLDocument
      Parameters:
      tagName - Description of the Parameter
      Returns:
      Description of the Return Value
    • subclass

      public Element subclass(Element oldEl)
      Description copied from interface: AbstractCMLDocument
      Wraps an existing W3C Element in a CML-specific subclass implementation.
      Specified by:
      subclass in interface AbstractCMLDocument
      Parameters:
      oldEl - the generic W3C element to subclass
      Returns:
      the subclassed element instance
    • createAbstractBase

      public AbstractBase createAbstractBase()
      creates new AbstractBase
      Specified by:
      createAbstractBase in interface AbstractCMLDocument
      Returns:
      the new element
    • getFirstElement

      public Element getFirstElement(String elementName)
      getFirstChild (cf AbstractBase)
      Specified by:
      getFirstElement in interface AbstractCMLDocument
      Parameters:
      elementName - Description of the Parameter
      Returns:
      the Element (null if none)
    • getElementList

      public Element[] getElementList(String elementName)
      getElementList (cf AbstractBase) NOTE this will get subelements as well as toplevel ones (for example Molecules which have Molecule children)
      Specified by:
      getElementList in interface AbstractCMLDocument
      Parameters:
      elementName - Description of the Parameter
      Returns:
      the Elements (null if none)
    • getElementVector

      public Vector<Element> getElementVector(String elementName)
      getChildVector (cf AbstractBase)
      Specified by:
      getElementVector in interface AbstractCMLDocument
      Parameters:
      elementName - Description of the Parameter
      Returns:
      the Elements (empty list if none)
    • setDebug

      public void setDebug(boolean d)
      toggle debugging
      Specified by:
      setDebug in interface AbstractCMLDocument
      Parameters:
      d - debug
    • getDebug

      public boolean getDebug()
      debug status
      Specified by:
      getDebug in interface AbstractCMLDocument
      Returns:
      is debug set
    • debug

      protected void debug(String s)
      output string if debug set
      Parameters:
      s - string to output
    • setVersion

      public void setVersion(String v) throws CMLException
      set CML version

      1 or 2 at present (default 2)

      Specified by:
      setVersion in interface CMLNode
      Parameters:
      v - version
    • setArraySyntax

      public void setArraySyntax(boolean syntax)
      set array syntax

      set CML array syntax (default false)

      Specified by:
      setArraySyntax in interface CMLNode
      Parameters:
      syntax -
    • writeXML

      public void writeXML(Writer w) throws CMLException, IOException
      write XML use current control (version and syntax)
      Specified by:
      writeXML in interface CMLNode
      Parameters:
      w - - output
      Throws:
      CMLException
      IOException
    • writeXML

      public void writeXML(Writer w, String control) throws IOException, CMLException
      write the document in XML, using node-specific routines
      Specified by:
      writeXML in interface CMLNode
      Parameters:
      w - the writer
      control - (cannot remember what this does!)
      Throws:
      IOException - Description of the Exception
      CMLException - Description of the Exception
    • main

      public static void main(String[] args)
      main
      Parameters:
      args - command line
    • clone

      public AbstractBase clone(AbstractBase element) throws CMLException
      clone element in context of document.
      Specified by:
      clone in interface AbstractCMLDocument
      Parameters:
      element - to clone (may or may not be owned by this)
      Returns:
      the cloned element (owner is this)
      Throws:
      CMLException - cannot clone non-AbstractBase
    • updateDelegates

      public void updateDelegates()
      update delegates. updates documentElement delegates (content and attributes) then recurses through children
      Specified by:
      updateDelegates in interface AbstractCMLDocument
    • updateDOM

      public void updateDOM()
      update DOM. updates documentElement DOM (content and attributes) then recurses through children
      Specified by:
      updateDOM in interface AbstractCMLDocument