org.jscience.ml.cml.cmlimpl
Class AbstractCMLDocumentImpl

java.lang.Object
  extended by org.jscience.ml.cml.dom.pmr.PMRNodeImpl
      extended by org.jscience.ml.cml.dom.pmr.PMRDocumentImpl
          extended by org.jscience.ml.cml.cmlimpl.AbstractCMLDocumentImpl
All Implemented Interfaces:
AbstractCMLDocument, CMLNode, PMRDocument, org.w3c.dom.Document, org.w3c.dom.Node

public class AbstractCMLDocumentImpl
extends PMRDocumentImpl
implements AbstractCMLDocument

The base class for any CML Document objects


Field Summary
protected  boolean arraySyntax
           
protected  boolean debug
           
static java.lang.String DEFAULT_OUTPUT_DTD
          Description of the Field
static java.lang.String DEFAULT_OUTPUT_ENCODING
          Description of the Field
protected  java.lang.String version
           
 
Fields inherited from class org.jscience.ml.cml.dom.pmr.PMRNodeImpl
childNodes, delegateNode, parentNode, pmrDocument, siblingNodes
 
Fields inherited from interface org.jscience.ml.cml.AbstractCMLDocument
DEFAULT_OUTPUT_NAMESPACE, NULL_DTD, NULL_NAMESPACE, PACKAGE_NAME
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.jscience.ml.cml.CMLNode
ARRAY, CML1, CML2
 
Constructor Summary
  AbstractCMLDocumentImpl()
          create an Empty Document.
protected AbstractCMLDocumentImpl(org.w3c.dom.Document doc)
          Constructor for the AbstractCMLDocumentImpl object
 
Method Summary
 AbstractBase clone(AbstractBase element)
          clone element in context of document.
 AbstractBase createAbstractBase()
          creates new AbstractBase
 org.w3c.dom.Element createSubclassedElement(java.lang.String tagName)
          Description of the Method
protected  void debug(java.lang.String s)
          output string if debug set
 boolean getDebug()
          debug status
 org.w3c.dom.Element[] getElementList(java.lang.String elementName)
          getElementList (cf AbstractBase) NOTE this will get subelements as well as toplevel ones (for example Molecules which have Molecule children)
 java.util.Vector getElementVector(java.lang.String elementName)
          getChildVector (cf AbstractBase)
 org.w3c.dom.Element getFirstElement(java.lang.String elementName)
          getFirstChild (cf AbstractBase)
static void main(java.lang.String[] args)
          main
 void setArraySyntax(boolean syntax)
          set array syntax

set CML array syntax (default false)

 void setDebug(boolean d)
          toggle debugging
 void setVersion(java.lang.String v)
          set CML version

1 or 2 at present (default 2)

 org.w3c.dom.Element subclass(org.w3c.dom.Element oldEl)
          DOCUMENT ME!
static AbstractBase transferOwnerDocument(AbstractCMLDocument doc, AbstractBase elem)
           
 void updateDelegates()
          update delegates.
 void updateDOM()
          update DOM.
 void writeXML(java.io.Writer w)
          write XML use current control (version and syntax)
 void writeXML(java.io.Writer w, java.lang.String control)
          write the document in XML, using node-specific routines
 
Methods inherited from class org.jscience.ml.cml.dom.pmr.PMRDocumentImpl
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion, test, test, toString
 
Methods inherited from class org.jscience.ml.cml.dom.pmr.PMRNodeImpl
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getDelegateNode, getDelegateParentNode, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setDelegateNode, setNodeValue, setOwnerDocument, setOwnerDocumentRecursively, setPrefix, setTextContent, setUserData, wrapRecursively
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Document
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Field Detail

DEFAULT_OUTPUT_ENCODING

public static final java.lang.String DEFAULT_OUTPUT_ENCODING
Description of the Field

See Also:
Constant Field Values

DEFAULT_OUTPUT_DTD

public static final java.lang.String DEFAULT_OUTPUT_DTD
Description of the Field

See Also:
Constant Field Values

version

protected java.lang.String version

arraySyntax

protected boolean arraySyntax

debug

protected boolean debug
Constructor Detail

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(org.w3c.dom.Document doc)
Constructor for the AbstractCMLDocumentImpl object

Parameters:
doc - Description of the Parameter
Method Detail

transferOwnerDocument

public static AbstractBase transferOwnerDocument(AbstractCMLDocument doc,
                                                 AbstractBase elem)

createSubclassedElement

public org.w3c.dom.Element createSubclassedElement(java.lang.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 org.w3c.dom.Element subclass(org.w3c.dom.Element oldEl)
Description copied from interface: AbstractCMLDocument
DOCUMENT ME!

Specified by:
subclass in interface AbstractCMLDocument
Parameters:
oldEl - DOCUMENT ME!
Returns:
DOCUMENT ME!

createAbstractBase

public AbstractBase createAbstractBase()
creates new AbstractBase

Specified by:
createAbstractBase in interface AbstractCMLDocument
Returns:
the new element

getFirstElement

public org.w3c.dom.Element getFirstElement(java.lang.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 org.w3c.dom.Element[] getElementList(java.lang.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 java.util.Vector getElementVector(java.lang.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(java.lang.String s)
output string if debug set

Parameters:
s - string to output

setVersion

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

1 or 2 at present (default 2)

Specified by:
setVersion in interface CMLNode
Parameters:
v - version
Throws:
unsupported - version
CMLException

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(java.io.Writer w)
              throws CMLException,
                     java.io.IOException
write XML use current control (version and syntax)

Specified by:
writeXML in interface CMLNode
Parameters:
w - - output
Throws:
CMLException
java.io.IOException

writeXML

public void writeXML(java.io.Writer w,
                     java.lang.String control)
              throws java.io.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:
java.io.IOException - Description of the Exception
CMLException - Description of the Exception

main

public static void main(java.lang.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