docx
    Preparing search index...

    Class BaseXmlComponentAbstract

    Abstract base class for all XML components in the library.

    BaseXmlComponent defines the minimal interface that all XML components must implement. It stores the XML element name (rootKey) and requires subclasses to implement the prepForXml method for serialization.

    class MyElement extends BaseXmlComponent {
    constructor() {
    super("w:myElement");
    }

    prepForXml(context: IContext): IXmlableObject {
    return { "w:myElement": {} };
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Prepares this component for XML serialization.

      This method is called by the Formatter to convert the component into an object structure that can be serialized to XML. Subclasses must implement this to define their XML representation.

      Parameters

      • context: IContext

        The serialization context

      Returns IXmlableObject | undefined

      The XML-serializable object, or undefined to exclude from output