AbstractAFPExtensionObject (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.render.afp.extensions

## Class AbstractAFPExtensionObject

- java.lang.Object
- - org.apache.fop.fo.FONode
  - - org.apache.fop.render.afp.extensions.AbstractAFPExtensionObject

- All Implemented Interfaces:
    Cloneable
  Direct Known Subclasses:
    AFPIncludeFormMapElement, AFPInvokeMediumMapElement, AFPPageOverlayElement, AFPPageSetupElement

      public abstract class AbstractAFPExtensionObject
      extends FONode

  Base class for the AFP-specific extension elements.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.fo.FONode

      `FONode.FONodeIterator, FONode.GatherContextInfoFunction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AFPExtensionAttachment` | `extensionAttachment` the AFP extension attachment
    `protected String` | `name` the element name of this extension

    - ### Fields inherited from class org.apache.fop.fo.FONode

      `FO_URI, FOX_URI, locator, log, nodeChangeBarList, parent, siblings, startOfNodeChangeBarList`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAFPExtensionObject(FONode parent, String name)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endOfNode()` Primarily used for making final content model validation checks and/or informing the `FOEventHandler` that the end of this FO has been reached.
    `ExtensionAttachment` | `getExtensionAttachment()` This method is overridden by extension elements and allows the extension element to return a pass-through attachment which the parent formatting objects should simply carry with them but otherwise ignore.
    `String` | `getLocalName()` Returns the local name (i.e.
    `String` | `getNamespaceURI()` Returns the namespace URI for this node
    `String` | `getNormalNamespacePrefix()` Returns the normally used namespace prefix for this node
    `protected abstract ExtensionAttachment` | `instantiateExtensionAttachment()` Instantiates extension attachment object
    `void` | `processNode(String elementName, Locator locator, Attributes attlist, PropertyList propertyList)` Initialize the node with its name, location information, and attributes The attributes must be used immediately as the sax attributes will be altered for the next element.
    `protected void` | `validateChildNode(Locator loc, String nsURI, String localName)` Checks to make sure, during SAX processing of input document, that the incoming node is valid for this (parent) node (e.g., checking to see that `fo:table` is not an immediate child of `fo:root`) called from `FOTreeBuilder.startElement(String, String, String, Attributes)` before constructing the child `FObj`.

    - ### Methods inherited from class org.apache.fop.fo.FONode

      `addCharacters, addChildNode, attachSiblings, bind, canHaveMarkers, characters, charIterator, clone, clone, collectDelimitedTextRanges, collectDelimitedTextRanges, createPropertyList, decorateWithContextInfo, errorText, finalizeNode, gatherContextInfo, getBuilderContext, getChangeBarList, getChildNodes, getChildNodes, getContentHandlerFactory, getContextInfo, getContextInfoAlt, getFOEventHandler, getFOValidationEventProducer, getLocator, getLocatorString, getLogger, getName, getName, getNameId, getNodePrefix, getNodeString, getParent, getRoot, getStructureTreeElement, getUserAgent, inMarker, invalidChildError, invalidChildError, invalidPropertyValueError, isBidiRangeBlockItem, isChangeBarElement, isDelimitedTextRangeBoundary, missingChildElementError, missingChildElementError, missingPropertyError, nodesOutOfOrderError, nodesOutOfOrderError, notSupportedChildError, removeChild, setLocator, setStructureTreeElement, startOfNode, tooManyNodesError, tooManyNodesError, tooManyNodesError, validateChildNode, warningText`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### extensionAttachment

          protected AFPExtensionAttachment extensionAttachment

      the AFP extension attachment

    - #### name

          protected String name

      the element name of this extension

  - ### Constructor Detail

    - #### AbstractAFPExtensionObject

          public AbstractAFPExtensionObject(FONode parent,
                                            String name)

      Parameters:
        `parent` - the parent formatting object
        `name` - the name of the afp element
      See Also:
        `FONode.FONode(FONode)`

  - ### Method Detail

    - #### validateChildNode

          protected void validateChildNode(Locator loc,
                                           String nsURI,
                                           String localName)
                                    throws ValidationException

      Checks to make sure, during SAX processing of input document, that the incoming node is valid for this (parent) node (e.g., checking to see that `fo:table` is not an immediate child of `fo:root`) called from `FOTreeBuilder.startElement(String, String, String, Attributes)` before constructing the child `FObj`.
      Overrides:
        `validateChildNode` in class `FONode`
      Parameters:
        `loc` - location in the FO source file
        `nsURI` - namespace of incoming node
        `localName` - name of the incoming node (without namespace prefix)
      Throws:
        `ValidationException` - if incoming node not valid for parent

    - #### getNamespaceURI

          public String getNamespaceURI()

      Returns the namespace URI for this node
      Overrides:
        `getNamespaceURI` in class `FONode`
      Returns:
        the namespace URI for this node

    - #### getNormalNamespacePrefix

          public String getNormalNamespacePrefix()

      Returns the normally used namespace prefix for this node
      Specified by:
        `getNormalNamespacePrefix` in class `FONode`
      Returns:
        the normally used namespace prefix for this kind of node (ex. "fo" for XSL-FO)

    - #### processNode

          public void processNode(String elementName,
                                  Locator locator,
                                  Attributes attlist,
                                  PropertyList propertyList)
                           throws FOPException

      Initialize the node with its name, location information, and attributes The attributes must be used immediately as the sax attributes will be altered for the next element.
      Overrides:
        `processNode` in class `FONode`
      Parameters:
        `elementName` - element name (e.g., "fo:block")
        `locator` - Locator object (ignored by default)
        `attlist` - Collection of attributes passed to us from the parser.
        `propertyList` - the property list of the parent node
      Throws:
        `FOPException` - for errors or inconsistencies in the attributes

    - #### endOfNode

          public void endOfNode()
                         throws FOPException

      Primarily used for making final content model validation checks and/or informing the `FOEventHandler` that the end of this FO has been reached. The default implementation simply calls `FONode.finalizeNode()`, without sending any event to the `FOEventHandler`.

      Note: the recommended way to override this method in subclasses is

      `super.endOfNode(); // invoke finalizeNode()`

      `getFOEventHandler().endXXX(); // send endOfNode() notification`

      Overrides:
        `endOfNode` in class `FONode`
      Throws:
        `FOPException` - if there's a problem during processing

    - #### instantiateExtensionAttachment

          protected abstract ExtensionAttachment instantiateExtensionAttachment()

      Instantiates extension attachment object
      Returns:
        extension attachment

    - #### getExtensionAttachment

          public ExtensionAttachment getExtensionAttachment()

      This method is overridden by extension elements and allows the extension element to return a pass-through attachment which the parent formatting objects should simply carry with them but otherwise ignore. This mechanism is used to pass non-standard information from the FO tree through to the layout engine and the renderers.
      Overrides:
        `getExtensionAttachment` in class `FONode`
      Returns:
        the extension attachment if one is created by the extension element, null otherwise.

    - #### getLocalName

          public String getLocalName()

      Returns the local name (i.e. without namespace prefix) of the node
      Specified by:
        `getLocalName` in class `FONode`
      Returns:
        the local name of this node

Copyright © 2025 Apache Software Foundation. All rights reserved.