org.jscience.ml.cml
Interface AbstractBase

All Superinterfaces:
CMLNode, org.w3c.dom.Element, org.w3c.dom.Node
All Known Implementing Classes:
CMLBaseImpl

public interface AbstractBase
extends org.w3c.dom.Element, CMLNode

The base class for all elementObjects in the Schema

Any element may have attributes:titleiddictRefconventionand convenience get/set methods are provided for all, through the interfaces AttributeTitle, AttributeId and AttributeConvention.An element (FOO) subclassed from a AbstractBase may be constructed in the following ways:FOO(). Creates a new empty element with null values of the attributes. Required for newInstance(), but use carefully since it has no tagName and no document associated with it.FOO(String tagName, Document document). Creates an empty element with null attribute names.FOO(org.w3c.dom.Element element). Creates a subclassed Element with the same attribute values as the input Element. Used when a DOM has been created with non-aware software. The routine makeAndProcessSubclass(Element element) will replace the current Element with the appropriate subclass.


Field Summary
static java.lang.String CML1
          output CML variants
static java.lang.String CML2
           
static java.lang.String CMLCDK
           
static java.lang.String[] CONTENT_MODEL
           
static java.lang.String CONVENTION
           
static java.lang.String DICTREF
           
static int FLOAT_TYPE
           
static java.lang.String ID
           
static int INTEGER_TYPE
           
static java.lang.String NAMESPACE_URI
           
static java.lang.String PACKAGE_NAME
           
static java.lang.String REF
           
static int STRING_TYPE
           
static java.lang.String TITLE
           
static int UNKNOWN
           
 
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
 
Method Summary
 void characters(SaxHandler saxHandler, java.lang.String content)
          SAX2 parsing routine called from characters() callback NOT namespace aware
 AbstractBase deepCopy()
          deep clones an element including subclassing

uses intermediate XML serialization object is owned by a new document

 AbstractBase deepCopy(AbstractCMLDocument document)
          deep clones an element including subclassing

uses intermediate XML serialization object is owned by document

 void endElement(SaxHandler saxHandler)
          SAX2 parsing routine called from endElement() callback NOT namespace aware
 java.lang.String getAttribute(java.lang.String attName)
          gets attribute, changing data type if required
 AbstractCMLDocument getCMLDocument()
          get owner document as CMLDocument.
 java.lang.String getContentValue()
          gets text content from an element should only be used for text-only or mixed content.
 boolean getDebug()
          debug status
 org.w3c.dom.Element getOrCreateChild(java.lang.String elemName)
          get a child of a given name If it doesn't exist, create and add it
 BaseTool getOrCreateTool()
          get or create tool.
 BaseTool getTool()
          get tool.
 void removeTextChildren()
          removes whitespace nodes or throws any Exception for non-whitespace ones
 void setAttribute(java.lang.String attName, java.lang.String attVal)
          sets attribute, changing data type if required
 void setContentValue(java.lang.String value)
          adds text content to an element should only be used for text-only or mixed content.
 void setDebug(boolean d)
          toggle debugging
 void setTextChild(java.lang.String value)
          addStringContent to Element

if no Text child, creates one if Text child, resets value if existing non-Text children, no action

 void setTool(BaseTool tool)
          set tool

sets the tool.

 void startElement(SaxHandler saxHandler, org.xml.sax.Attributes attributes)
          SAX2 parsing routine called from startElement() callback NOT namespace aware
 void updateDelegateAttributes()
          update delegate attributes.
 void updateDelegateContent()
          update delegate content.
 void updateDelegates()
          update delegates.
 void updateDOM()
          update DOM.
 void updateDOMAttributes()
          update DOM attributes.
 void updateDOMContent()
          update DOM content.
 void writeXML(java.io.Writer w)
          write XML use current control (version and syntax)
 
Methods inherited from interface org.w3c.dom.Element
getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
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
 
Methods inherited from interface org.jscience.ml.cml.CMLNode
setArraySyntax, setVersion, writeXML
 

Field Detail

NAMESPACE_URI

static final java.lang.String NAMESPACE_URI
See Also:
Constant Field Values

PACKAGE_NAME

static final java.lang.String PACKAGE_NAME
See Also:
Constant Field Values

CONTENT_MODEL

static final java.lang.String[] CONTENT_MODEL

UNKNOWN

static final int UNKNOWN
See Also:
Constant Field Values

STRING_TYPE

static final int STRING_TYPE
See Also:
Constant Field Values

FLOAT_TYPE

static final int FLOAT_TYPE
See Also:
Constant Field Values

INTEGER_TYPE

static final int INTEGER_TYPE
See Also:
Constant Field Values

CONVENTION

static final java.lang.String CONVENTION
See Also:
Constant Field Values

DICTREF

static final java.lang.String DICTREF
See Also:
Constant Field Values

ID

static final java.lang.String ID
See Also:
Constant Field Values

REF

static final java.lang.String REF
See Also:
Constant Field Values

TITLE

static final java.lang.String TITLE
See Also:
Constant Field Values

CML1

static final java.lang.String CML1
output CML variants

See Also:
Constant Field Values

CML2

static final java.lang.String CML2
See Also:
Constant Field Values

CMLCDK

static final java.lang.String CMLCDK
See Also:
Constant Field Values
Method Detail

setAttribute

void setAttribute(java.lang.String attName,
                  java.lang.String attVal)
sets attribute, changing data type if required

Specified by:
setAttribute in interface org.w3c.dom.Element
Parameters:
attName -
attVal -

getAttribute

java.lang.String getAttribute(java.lang.String attName)
gets attribute, changing data type if required

Specified by:
getAttribute in interface org.w3c.dom.Element
Parameters:
attName -

removeTextChildren

void removeTextChildren()
                        throws CMLException
removes whitespace nodes or throws any Exception for non-whitespace ones

Throws:
CMLException - non-whitespace Text node

getOrCreateChild

org.w3c.dom.Element getOrCreateChild(java.lang.String elemName)
                                     throws CMLException
get a child of a given name If it doesn't exist, create and add it

Parameters:
elemName - the elementName to get/create (identified by elementName not class)
Returns:
the Element
Throws:
CMLException - element cannot be added (violates content model)

characters

void characters(SaxHandler saxHandler,
                java.lang.String content)
                throws CMLException
SAX2 parsing routine called from characters() callback NOT namespace aware

Parameters:
saxHandler - SaxHandler
content - throws exception (probably application specific)
Throws:
CMLException

endElement

void endElement(SaxHandler saxHandler)
                throws CMLException
SAX2 parsing routine called from endElement() callback NOT namespace aware

Parameters:
saxHandler - Saxhandler throws exception (probably application specific)
Throws:
CMLException

startElement

void startElement(SaxHandler saxHandler,
                  org.xml.sax.Attributes attributes)
                  throws CMLException
SAX2 parsing routine called from startElement() callback NOT namespace aware

Parameters:
saxHandler - Saxhandler
attributes - the attribute list throws exception (probably application specific)
Throws:
CMLException

setContentValue

void setContentValue(java.lang.String value)
adds text content to an element should only be used for text-only or mixed content.

Parameters:
value - the content
Throws:
CMLException - thrown by subclasses

getContentValue

java.lang.String getContentValue()
gets text content from an element should only be used for text-only or mixed content.

Throws:
CMLException - thrown by subclasses

deepCopy

AbstractBase deepCopy()
deep clones an element including subclassing

uses intermediate XML serialization object is owned by a new document

Returns:
the copied object

deepCopy

AbstractBase deepCopy(AbstractCMLDocument document)
deep clones an element including subclassing

uses intermediate XML serialization object is owned by document

Parameters:
document - ownerDocument
Returns:
the copied object

writeXML

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

getCMLDocument

AbstractCMLDocument getCMLDocument()
get owner document as CMLDocument.

Returns:
the document

getTool

BaseTool getTool()
get tool.

creates one if not already created do not use if subclass is known to compiler (use FooToolImpl.getTool(foo) instead)

Returns:
the tool

getOrCreateTool

BaseTool getOrCreateTool()
get or create tool.

creates one if not already created should only be used when the subclass is not known to the compiler i.e. where an abstractBase is found

Returns:
the tool

setTool

void setTool(BaseTool tool)
set tool

sets the tool. NOT user-callable

Parameters:
tool -

setDebug

void setDebug(boolean d)
toggle debugging

Parameters:
d - debug

getDebug

boolean getDebug()
debug status

Returns:
is debug set

setTextChild

void setTextChild(java.lang.String value)
addStringContent to Element

if no Text child, creates one if Text child, resets value if existing non-Text children, no action

Parameters:
value - to add

updateDelegates

void updateDelegates()
update delegates. updates this delegates (content and attributes) then recurses through children


updateDOM

void updateDOM()
update DOM. updates this DOM (content and attributes) then recurses through children


updateDelegateContent

void updateDelegateContent()
update delegate content.


updateDelegateAttributes

void updateDelegateAttributes()
update delegate attributes.


updateDOMContent

void updateDOMContent()
update DOM content.


updateDOMAttributes

void updateDOMAttributes()
update DOM attributes.