org.apache.fop.fo

## Class XMLWhiteSpaceHandler

- java.lang.Object
- - org.apache.fop.fo.XMLWhiteSpaceHandler

-     public class XMLWhiteSpaceHandler
      extends Object

  Class encapsulating the functionality for white-space-handling during refinement stage. The `handleWhiteSpace()` methods are called during FOTree-building and marker-cloning:
  - from `FObjMixed.addChildNode()`
  - from `FObjMixed.endOfNode()`
  - from `FObjMixed.handleWhiteSpaceFor()`
  Each time one of the variants is called, white-space is handled for all `FOText` or `Character` nodes that were added:
  - either prior to `newChild` (and after the previous non-text child node)
  - or, if `newChild` is `null`, after the previous non-text child
  The iteration always starts at `firstTextNode`, goes on until the last text-node is reached, and deals only with `FOText` or `Character` nodes.
  Note: if the method is called from an inline's endOfNode(), there is too little context to decide whether trailing white-space may be removed, so the pending inline is stored in a List, together with an iterator for which the next() method returns the first in the trailing sequence of white- space characters. This List is processed again at the end of the ancestor block.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLWhiteSpaceHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `handleWhiteSpace(FObjMixed fo, FONode firstTextNode)` Handle white-space for the fo that is passed in, starting at firstTextNode (when a nested FO is encountered)
    `void` | `handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild)` Handle white-space for the fo that is passed in, starting at firstTextNode
    `protected void` | `reset()` Reset the handler, release all references

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

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

- - ### Constructor Detail

    - #### XMLWhiteSpaceHandler

          public XMLWhiteSpaceHandler()

  - ### Method Detail

    - #### handleWhiteSpace

          public void handleWhiteSpace(FObjMixed fo,
                                       FONode firstTextNode,
                                       FONode nextChild)

      Handle white-space for the fo that is passed in, starting at firstTextNode
      Parameters:
        `fo` - the FO for which to handle white-space
        `firstTextNode` - the node at which to start
        `nextChild` - the node that will be added to the list after firstTextNode

    - #### reset

          protected final void reset()

      Reset the handler, release all references

    - #### handleWhiteSpace

          public void handleWhiteSpace(FObjMixed fo,
                                       FONode firstTextNode)

      Handle white-space for the fo that is passed in, starting at firstTextNode (when a nested FO is encountered)
      Parameters:
        `fo` - the FO for which to handle white-space
        `firstTextNode` - the node at which to start

Copyright © 2023 Apache Software Foundation. All rights reserved.