Interface AbstractBase

All Superinterfaces:
CMLNode, Element, Node
All Known Implementing Classes:
CMLBaseImpl

public interface AbstractBase extends 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.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Field Details

  • Method Details

    • setAttribute

      void setAttribute(String attName, String attVal)
      sets attribute, changing data type if required
      Specified by:
      setAttribute in interface Element
      Parameters:
      attName -
      attVal -
    • getAttribute

      String getAttribute(String attName)
      gets attribute, changing data type if required
      Specified by:
      getAttribute in interface 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

      Element getOrCreateChild(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, 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, 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(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

      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(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
    • 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(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.