Chapter 8. The trees in FOP

Table of Contents

1. Overview
2. The tree of BreakPoss
3. Example of an FO and area tree
3.1. The FO file
3.2. The corresponding FO tree
3.3. The corresponding area tree

1. Overview

  1. The FO document. Each XML document and therefore also an FO document has a hierarchical structure that can be modeled as a tree.
  2. The FO DOM tree. This tree has the same hierarchical structure as an FO document, and is often built from an XML document.

FOP can work from either an FO document or an FO DOM tree. FOP does not build a DOM tree from an FO document.

  1. The FO tree. FOP builds this tree from either the FO document or the FO DOM tree. The FO nodes in this tree correspond to the elements in the FO document or the XML nodes in the FO DOM tree. Note, however, that they are different from DOM tree nodes.

When a sufficient part of the FO tree has been built (in current FOP the subtree of a PageSequence FO node), the layout process is started. This process builds three trees.

  1. The LM tree. This tree corresponds closely to the FO tree because each FO node creates a layout manager. But there are deviations. For example, a BlockLayoutManager creates a LineLayoutManager for each consecutive sequence of child FO nodes that generate inline areas.
  2. The BP tree. Each layout manager returns zero or more BreakPoss to its parent. These BreakPoss are connected to BreakPoss that the layout manager received from its child layout managers. This is not a real tree. There are many BP without a parent BP. They are connected to their siblings by their LM.
  3. The Area tree. Using the information stored in the BP tree and in the LMs connected with the BPs, layout areas are constructed. These areas are placed within other areas, which is expressed in a tree hierarchy.