Interface AbstractBase
- All Known Implementing Classes:
CMLBaseImpl
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.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringoutput CML variantsstatic final Stringstatic final Stringstatic final String[]static final Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final intFields inherited from interface 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(SaxHandler saxHandler, String content) SAX2 parsing routine called from characters() callback NOT namespace awaredeepCopy()deep clones an element including subclassingdeepCopy(AbstractCMLDocument document) deep clones an element including subclassingvoidendElement(SaxHandler saxHandler) SAX2 parsing routine called from endElement() callback NOT namespace awaregetAttribute(String attName) gets attribute, changing data type if requiredget owner document as CMLDocument.gets text content from an element should only be used for text-only or mixed content.booleangetDebug()debug statusgetOrCreateChild(String elemName) get a child of a given name If it doesn't exist, create and add itget or create tool.getTool()get tool.voidremoves whitespace nodes or throws any Exception for non-whitespace onesvoidsetAttribute(String attName, String attVal) sets attribute, changing data type if requiredvoidsetContentValue(String value) adds text content to an element should only be used for text-only or mixed content.voidsetDebug(boolean d) toggle debuggingvoidsetTextChild(String value) addStringContent to Elementvoidset toolvoidstartElement(SaxHandler saxHandler, Attributes attributes) SAX2 parsing routine called from startElement() callback NOT namespace awarevoidupdate delegate attributes.voidupdate delegate content.voidupdate delegates. updates this delegates (content and attributes) then recurses through childrenvoidupdate DOM. updates this DOM (content and attributes) then recurses through childrenvoidupdate DOM attributes.voidupdate DOM content.voidwrite XML use current control (version and syntax)Methods inherited from interface CMLNode
setArraySyntax, setVersion, writeXMLMethods inherited from interface Element
getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNSMethods inherited from interface 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 Details
-
NAMESPACE_URI
- See Also:
-
PACKAGE_NAME
- See Also:
-
CONTENT_MODEL
-
UNKNOWN
static final int UNKNOWN- See Also:
-
STRING_TYPE
static final int STRING_TYPE- See Also:
-
FLOAT_TYPE
static final int FLOAT_TYPE- See Also:
-
INTEGER_TYPE
static final int INTEGER_TYPE- See Also:
-
CONVENTION
- See Also:
-
DICTREF
- See Also:
-
ID
- See Also:
-
REF
- See Also:
-
TITLE
- See Also:
-
CML1
-
CML2
- See Also:
-
CMLCDK
- See Also:
-
-
Method Details
-
setAttribute
sets attribute, changing data type if required- Specified by:
setAttributein interfaceElement- Parameters:
attName-attVal-
-
getAttribute
gets attribute, changing data type if required- Specified by:
getAttributein interfaceElement- Parameters:
attName-
-
removeTextChildren
removes whitespace nodes or throws any Exception for non-whitespace ones- Throws:
CMLException- non-whitespace Text node
-
getOrCreateChild
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
SAX2 parsing routine called from characters() callback NOT namespace aware- Parameters:
saxHandler- SaxHandlercontent- throws exception (probably application specific)- Throws:
CMLException
-
endElement
SAX2 parsing routine called from endElement() callback NOT namespace aware- Parameters:
saxHandler- Saxhandler throws exception (probably application specific)- Throws:
CMLException
-
startElement
SAX2 parsing routine called from startElement() callback NOT namespace aware- Parameters:
saxHandler- Saxhandlerattributes- the attribute list throws exception (probably application specific)- Throws:
CMLException
-
setContentValue
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
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
deep clones an element including subclassing uses intermediate XML serialization object is owned by document- Parameters:
document- ownerDocument- Returns:
- the copied object
-
writeXML
write XML use current control (version and syntax)- Specified by:
writeXMLin interfaceCMLNode- Parameters:
w- - output- Throws:
CMLExceptionIOException
-
getCMLDocument
-
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
-
setDebug
void setDebug(boolean d) toggle debugging- Parameters:
d- debug
-
getDebug
boolean getDebug()debug status- Returns:
- is debug set
-
setTextChild
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.
-