Class MathMlContainerElement<T extends MathMlContainerElement<T>>

Type Parameters:
T -
Direct Known Subclasses:
Annotation, AnnotationXml, MathMl, Menclose, Merror, Mfrac, Mi, Mmultiscripts, Mn, Mo, Mover, Mpadded, Mphantom, Mroot, Mrow, Ms, Msqrt, Msub, Msubsup, Msup, Mtable, Mtd, Mtext, Mtr, Munder, Munderover, Semantics

public abstract class MathMlContainerElement<T extends MathMlContainerElement<T>> extends MathMlElement<T>
Abstract base class for MathML container elements that accept child MathML elements.

MathML container elements like <math>, <mrow>, <mfrac>, and <msqrt> can contain other MathML elements as children. This class provides type-safe child management that restricts children to MathMlElement types, preventing invalid mixing of HTML and MathML content.

In addition to the type-safe Element.addElement(MathMlElement) method, this class implements

invalid reference
ContainerIntf
to provide the full set of container operations.

Since:
2026
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • MathMlContainerElement

      protected MathMlContainerElement(String tagName)
      Constructs a MathML container element with the specified tag name.
      Parameters:
      tagName - the MathML tag name (e.g., "math", "mrow", "mfrac")
  • Method Details

    • removeAllElements

      public void removeAllElements()
      Removes all child elements from this element.

      Each child is unlinked and registered for DOM removal if the element is attached to a page.

      Overrides:
      removeAllElements in class Element<T extends MathMlContainerElement<T>>
    • removeElement

      public void removeElement(MathMlElement child)
    • removeElement

      public void removeElement(String id)
      Removes a child element by its ID.
      Overrides:
      removeElement in class Element<T extends MathMlContainerElement<T>>
      Parameters:
      id - The ID of the child element to remove.
    • setText

      public void setText(String text)
      Sets the text content of this element, replacing any existing content.
      Overrides:
      setText in class Element<T extends MathMlContainerElement<T>>
      Parameters:
      text - The text content to set.
    • addText

      public void addText(String text)
      Appends text content to this element.
      Overrides:
      addText in class Element<T extends MathMlContainerElement<T>>
      Parameters:
      text - The text content to append.