|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.ml.cml.dom.pmr.PMRNodeImpl
org.jscience.ml.cml.dom.pmr.PMRElementImpl
org.jscience.ml.cml.cmlimpl.CMLBaseImpl
public class CMLBaseImpl
The base class for all elementObjects mentioned in the Schema
Any CML element may have attributes:titleiddictRefconvention and convenience get/set methods are provided for allAn 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, CMLDocument 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-CML-aware software. The routine makeAndProcessSubclass(Element element) will replace the current Element with the appropriate CML subclass.FOO(String title, String id, String dictRef, String convention). Makes subclassed Element and sets attribute values.
| Field Summary | |
|---|---|
protected boolean |
arraySyntax
|
protected boolean |
debug
|
protected AbstractCMLDocument |
ownerDocument
|
protected java.lang.String |
tagName
|
protected BaseTool |
tool
|
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.AbstractBase |
|---|
CML1, CML2, CMLCDK, CONTENT_MODEL, CONVENTION, DICTREF, FLOAT_TYPE, ID, INTEGER_TYPE, NAMESPACE_URI, PACKAGE_NAME, REF, STRING_TYPE, TITLE, 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 |
| Constructor Summary | |
|---|---|
|
CMLBaseImpl()
create a Node WITHOUT tagName OR document Use with care |
protected |
CMLBaseImpl(java.lang.String tagName,
AbstractCMLDocument document)
used when creating new nodes in a DOM |
|
CMLBaseImpl(java.lang.String tagName,
org.w3c.dom.Document document)
|
| Method Summary | |
|---|---|
void |
addChild(org.w3c.dom.Element elem)
content model adds a child to the element content. |
void |
addTextChild(java.lang.String value)
Deprecated. use setTextChild instead |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Element elem)
traps the addition of an child to the element content By default this will be routed to addChild() and org.w3c.dom.Node.appendChild(), but other element-specific stuff can be interposed (within the Cont |
void |
characters(SaxHandler saxHandler,
java.lang.String content)
SAX2 parsing routine called from characters() callback NOT namespace aware |
static java.lang.String |
createToolClassName(AbstractBase abstractBase)
constructs a class name for tool at present converts some.where.bar.FooImpl to some.where.tool.FooToolImpl |
protected void |
debug(java.lang.String s)
output string if debug set |
AbstractBase |
deepCopy()
deep clones an element including subclassing. |
AbstractBase |
deepCopy(AbstractCMLDocument document)
deep clones an element including subclassing uses intermediate XML serialization object is owned by document |
void |
deleteChild(org.w3c.dom.Element elem)
delete an element The element must have been previously created and present in the DOM |
void |
endElement(SaxHandler saxHandler)
SAX2 parsing routine called from endElement() callback NOT namespace aware |
org.w3c.dom.Element[] |
getChildList(java.lang.String elementName)
gets a (typed) list of child elements with a given name |
java.util.Vector |
getChildVector(java.lang.String elementName)
gets a Vector of all child elements with this name |
java.lang.String |
getClassTagName()
|
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 |
getFirstChild(java.lang.String elementName)
gets the first Child of a given type (by elementName) This method will normally be used when there is a single child of this type |
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. |
protected void |
init()
|
static void |
outputChildren(org.w3c.dom.Element elem,
java.io.Writer w,
java.lang.String control)
|
void |
removeTextChildren()
removes whitespace nodes or throws any Exception for non-whitespace ones |
void |
setArraySyntax(boolean syntax)
set array syntax set CML array syntax (default false) |
void |
setAttribute(java.lang.String name,
java.lang.String value)
set attribute. |
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 t)
set tool not user-callable |
void |
setVersion(java.lang.String v)
set CML version 1 or 2 at present (default 2) |
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) |
void |
writeXML(java.io.Writer w,
java.lang.String control)
write XML (allows for syntactic variants) |
static void |
writeXML0(org.w3c.dom.Element elem,
java.io.Writer w,
java.lang.String control)
|
| Methods inherited from class org.jscience.ml.cml.dom.pmr.PMRElementImpl |
|---|
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jscience.ml.cml.AbstractBase |
|---|
getAttribute |
| 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 |
| Field Detail |
|---|
protected java.lang.String version
protected boolean arraySyntax
protected BaseTool tool
protected boolean debug
protected java.lang.String tagName
protected AbstractCMLDocument ownerDocument
| Constructor Detail |
|---|
public CMLBaseImpl()
protected CMLBaseImpl(java.lang.String tagName,
AbstractCMLDocument document)
public CMLBaseImpl(java.lang.String tagName,
org.w3c.dom.Document document)
| Method Detail |
|---|
protected void init()
public AbstractCMLDocument getCMLDocument()
AbstractBase
getCMLDocument in interface AbstractBasepublic java.lang.String getClassTagName()
public void addChild(org.w3c.dom.Element elem)
throws CMLException
elem - the element to add (identified by elementName not class)
CMLException - element cannot be added (violates content model)
public void deleteChild(org.w3c.dom.Element elem)
throws CMLException
elem - element to be deleted.
CMLException - element would leave invalid contentpublic org.w3c.dom.Element getFirstChild(java.lang.String elementName)
elementName -
public java.util.Vector getChildVector(java.lang.String elementName)
elementName -
public org.w3c.dom.Element[] getChildList(java.lang.String elementName)
elementName -
public org.w3c.dom.Node appendChild(org.w3c.dom.Element elem)
throws CMLException
elem - the element to add (identified by elementName not class)
CMLException - element cannot be added (violates content model)
public org.w3c.dom.Element getOrCreateChild(java.lang.String elemName)
throws CMLException
getOrCreateChild in interface AbstractBaseelemName - the elementName to get/create (identified by elementName not class)
CMLException - element cannot be added (violates content model)public void setContentValue(java.lang.String value)
setContentValue in interface AbstractBasevalue - the content
CMLException - thrown by subclassespublic java.lang.String getContentValue()
getContentValue in interface AbstractBaseCMLException - thrown by subclasses
public void removeTextChildren()
throws CMLException
removeTextChildren in interface AbstractBaseCMLException - non-whitespace Text node
public void characters(SaxHandler saxHandler,
java.lang.String content)
throws CMLException
characters in interface AbstractBasesaxHandler - SaxHandlercontent - throws exception (probably application specific)
CMLException
public void endElement(SaxHandler saxHandler)
throws CMLException
endElement in interface AbstractBasesaxHandler - Saxhandler
throws exception (probably application specific)
CMLException
public void startElement(SaxHandler saxHandler,
org.xml.sax.Attributes attributes)
throws CMLException
startElement in interface AbstractBasesaxHandler - Saxhandlerattributes - the attribute list
throws exception (probably application specific)
CMLException
public void setAttribute(java.lang.String name,
java.lang.String value)
setAttribute in interface AbstractBasesetAttribute in interface org.w3c.dom.ElementsetAttribute in class PMRElementImplname - The name of the attribute to create or alter.value - Value to set in string form.public void addTextChild(java.lang.String value)
value - to addpublic void setTextChild(java.lang.String value)
setTextChild in interface AbstractBasevalue - to addpublic void setDebug(boolean d)
setDebug in interface AbstractBased - debugpublic boolean getDebug()
getDebug in interface AbstractBaseprotected void debug(java.lang.String s)
s - string to output
public void setVersion(java.lang.String v)
throws CMLException
setVersion in interface CMLNodev - version
unsupported - version
CMLExceptionpublic void setArraySyntax(boolean syntax)
setArraySyntax in interface CMLNodesyntax -
public void writeXML(java.io.Writer w,
java.lang.String control)
throws CMLException,
java.io.IOException
writeXML in interface CMLNodecontrol - - application specific string
for example "CML1 array" or "CML2"w - - output
java.io.IOException
CMLException
public void writeXML(java.io.Writer w)
throws CMLException,
java.io.IOException
writeXML in interface AbstractBasewriteXML in interface CMLNodew - - output
CMLException
java.io.IOException
public static void writeXML0(org.w3c.dom.Element elem,
java.io.Writer w,
java.lang.String control)
throws java.io.IOException,
CMLException
java.io.IOException
CMLException
public static void outputChildren(org.w3c.dom.Element elem,
java.io.Writer w,
java.lang.String control)
throws java.io.IOException,
CMLException
java.io.IOException
CMLExceptionpublic AbstractBase deepCopy()
deepCopy in interface AbstractBasepublic AbstractBase deepCopy(AbstractCMLDocument document)
deepCopy in interface AbstractBasedocument - ownerDocument
public BaseTool getTool()
getTool in interface AbstractBasepublic BaseTool getOrCreateTool()
getOrCreateTool in interface AbstractBasepublic void setTool(BaseTool t)
setTool in interface AbstractBaset - toolpublic static java.lang.String createToolClassName(AbstractBase abstractBase)
abstractBase - class object
public void updateDelegates()
updateDelegates in interface AbstractBasepublic void updateDOM()
updateDOM in interface AbstractBasepublic void updateDelegateContent()
updateDelegateContent in interface AbstractBasepublic void updateDelegateAttributes()
updateDelegateAttributes in interface AbstractBasepublic void updateDOMContent()
updateDOMContent in interface AbstractBasepublic void updateDOMAttributes()
updateDOMAttributes in interface AbstractBase
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||