From 418e78be92bc86ec3582cbd2e8f79c72a9ffa101 Mon Sep 17 00:00:00 2001
From: William Victor Mote The issue here is that we wish to recycle FO Tree memory as much as possible. There are at least three possible places that FO Tree fragments can be passed to the Layout process, and their memory recycled: This issue is implied by the requirement to process documents of arbitrary size. Unless some arbitrary limit is placed on the size of page-sequence objects, FOP must be able to serialize FO tree fragments as necessary. The FO Tree is an internal representation of the input XSL-FO document.
-The tree is created by building the elements and attributes from the SAX events.
-The process of building the FO Tree corresponds to the Objectify step from the spec.
-The Refinement step is part of reading and using the properties which may happen immediately or during the layout process. The FO Tree is used as an intermediatory structure which is converted
-into the area tree. The complete FO tree should not be held in memory
-since FOP should be able to handle FO documents of any size. The FO Tree is simply a heirarchy of java objects that represent the fo elements from xml.
-The traversal is done by the layout or structure process only in the flow elements. The FO Tree is an internal hierarchical representation (java objects and properties) of the input XSL-FO document, and is created from the parsing of that XSL-FO document.
+The process of building the FO Tree corresponds to the Objectify step in the XSL-FO spec.
+The FO Tree is an intermediate structure which will later be converted into the area tree. The SAX Events that are fired by the parsing process are caught by the FO Tree system.
+Events for starting an element, ending an element, and text data are assembled by the FO Tree system into a set of objects that represent the input FO document. For attributes attached to an XSL-FO element, a property list mapping is used to convert the attribute into properties of the object related to the element. Elements from foreign namespaces that are recognized by FOP fall into the following categories: For unrecognized namespaces, a dummy object or a generic DOM is created. While the tree building is mainly about creating the FO Tree, some FO Tree events trigger processes in other parts of FOP.
+The end of a page-sequence element triggers the layout process for that page-sequence (see discussion of Recycling).
+Also, the end of the XML document tells the renderer that it can finalize the output document. To minimize the amount of memory used by FOP, we wish to recycle FO Tree memory as much as possible.
+There are at least three possible places that FO Tree fragments could be passed to the Layout process, so that their memory can be reused: This issue is implied by the requirement to process documents of arbitrary size. Unless some arbitrary limit is placed on the size of page-sequence objects, FOP must be able to serialize FO tree fragments as necessary. The first elements in a document are the elements for the page master setup.
+This is usually only a small number and will be used throughout the document to create new pages.
+These elements are kept as a factory to create the page and appropriate regions whenever a new page is requested by the layout.
+The objects in the FO Tree that represent these elements are themselves the factory.
+The root element keeps these objects as a factory for the page sequences. The elements that are in the flow of the document are a set of elements
+that is needed for the layout process. Each element is important in the
+creation of areas. The remaining FO Objects are things like page-sequence, title and color-profile.
+These are handled by their parent element; i.e. the root looks after the declarations and the declarations maintains a list of colour profiles.
+The page-sequences are direct descendents of root. The base class for all objects in the tree is FONode. The base class for
@@ -51,7 +85,8 @@ may have children. Each xml element is represented by a java object. For pagination the
classes are in
-
-
+
+
+
+ org.apache.fop.fo.pagination.*
, for elements in the flow
they are in org.apache.fop.fo.flow.*
and some others are in
-org.apache.fop.fo.*.
org.apache.fop.fo.*.
+
The XML attributes on each element are passed to the object. The objects -that represent FO objects then convert the attributes into properties.
-Since properties can be inherited the PropertyList class handles resolving -properties for a particular element. -All properties are specified in an XML file. Classes are created -automatically during the build process.
-In some cases the element may be moved to have a different parent, for -example markers, or the inheritance could be different, for example -initial property set.
-Properties (recall that FO's have properties, areas have traits, and XML -nodes have attributes) are also a concern of FOTreeBuilder. It -accomplishes this by using a PropertyListBuilder. There is a -separate PropertyListBuilder for each namespace encountered -while building the FO tree. Each Builder object contains a hash of -property names and their respective makers. It may also -contain element-specific property maker hashes; these are based on the -local name of the flow object, ie. table-row, not -fo:table-row. If an element-specific property mapping exists, -it is preferred to the generic mapping.
-The base class for all
-properties is Property, and all the property makers extend
-Property.Maker. A more complete discussion of the property
-architecture may be found in
FOP supports the handlingof foreign XML. -The XML is converted internally into a DOM, this is then available to -the FO tree to convert the DOM into another format which can be rendered. -In the case of SVG the DOM needs to be created with Batik, so an element -mapping is used to read all elements in the SVG namespace and pass them -into the Batik DOM.
-The base class for foreign XML is XMLObj. This class handles creating a
+ For SVG, the DOM needs to be created with Batik, so an element mapping is used to read all elements in the SVG namespace and pass them into the Batik DOM. The base class for foreign XML is XMLObj. This class handles creating a
DOM Element and the setting of attributes. It also can create a DOM
Document if it is a top level element, class XMLElement.
This class must be extended for the namespace of the XML elements. For
unknown namespaces the class is UnknowXMLObj. If some special processing is needed then the top level element can extend
+ If some special processing is needed then the top level element can extend
the XMLObj. For example the SVGElement makes the special DOM required for
batik and gets the size of the svg. Foreign XML will usually be in an fo:instream-foreign-object, the XML will
+ Foreign XML will usually be in an fo:instream-foreign-object, the XML will
be passed to the render as a DOM where the render will be able to handle
it. Other XML from an unknwon namespace will be ignored. By using element mappings it is possible to read other XML and either If an element is in a known namespace but the element is unknown then an
+ By using element mappings it is possible to read other XML and either If an element is in a known namespace but the element is unknown then an
Unknown object is created. This is mainly to provide information to the
user.
This could happen if the fo document contains an element from a different
version or the element is misspelt. It is possible to add extensions to FOP so that you can extend the ability of
-FOP with respect to render output, document specific information or extended
-layout functionality. The first elements in a document are the elements for the page master setup.
-This is usually only a small number and will be used throughout the document to create new pages.
-These elements are kept as a factory to create the page and appropriate regions whenever a new page is requested by the layout.
-The objects in the FO Tree that represent these elements are themselves the factory.
-The root element keeps these objects as a factory for the page sequences. The elements that are in the flow of the document are a set of elements
-that is needed for the layout process. Each element is important in the
-creation of areas. The remaining FO Objects are things like page-sequence, title and color-profile.
-These are handled by their parent element; i.e. the root looks after the declarations and the declarations maintains a list of colour profiles.
-The page-sequences are direct descendents of root.
-
-
+
+
The layout process is handled by a set of layout managers. The block level layout managers are used to create the block areas which are added to the region area of a page.
+The traversal is done by the layout or structure process only in the flow elements.
Layout should handle floats, footnotes and keeps in a simple, straightforward way.
diff --git a/src/documentation/content/xdocs/design/parsing.xml b/src/documentation/content/xdocs/design/parsing.xml index 396a1a263..05c5d0ebc 100644 --- a/src/documentation/content/xdocs/design/parsing.xml +++ b/src/documentation/content/xdocs/design/parsing.xml @@ -3,7 +3,7 @@ "http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-forrest/src/resources/schema/dtd/document-v11.dtd">See the Input Section of the User Embedding Document for a discussion of input usage patterns and some implementation details.
+FOP's FO Tree Mechanism is responsible for catching the SAX events and processing them.
See User Extensions for a discussion of standard extensions shipped with FOP, and their related namespaces.
See Developer Extensions for a discussion of the mechanisms in place to allow developers to add their own extensions, including how to tell FOP about the foreign namespace.
The SAX Events will fire all the information for the document with start element, end element, text data etc. -This information is used to build up a representation of the FO document. -To do this for a namespace there is a set of element mappings. -When an element + namepsace mapping is found then it can create an object for that element. -If the element is not found then it creates a dummy object or a generic DOM for unknown namespaces.
-The object is then setup and then given attributes for the element. -For the FO Tree the attributes are converted into properties. -The FO objects use a property list mapping to convert the attributes into a list of properties for the element. -For other XML, for example SVG, a DOM of the XML is constructed. -This DOM can then be passed through to the renderer. -Other element mappings can be used in different ways, for example to create elements that create areas during the layout process or setup information for the renderer etc.
-While the tree building is mainly about creating the FO Tree there are some stages that can propagate to the renderer. -At the end of a page sequence we know that all pages in the page sequence can be laid out without being effected by any further XML. -The significance of this is that the FO Tree for the page sequence may be able to be disposed of. -The end of the XML document also tells us that we can finalise the output document. -(The layout of individual pages is accomplished by the layout managers page at a time; i.e. they do not need to wait for the end of the page sequence. -The page may not yet be complete, however, containing forward page number references, for example.)
-The XML attributes on each element are passed to the object. The objects +that represent FO objects then convert the attributes into properties.
+Since properties can be inherited the PropertyList class handles resolving +properties for a particular element. +All properties are specified in an XML file. Classes are created +automatically during the build process.
+In some cases the element may be moved to have a different parent, for +example markers, or the inheritance could be different, for example +initial property set.
+Properties (recall that FO's have properties, areas have traits, and XML +nodes have attributes) are also a concern of FOTreeBuilder. It +accomplishes this by using a PropertyListBuilder. There is a +separate PropertyListBuilder for each namespace encountered +while building the FO tree. Each Builder object contains a hash of +property names and their respective makers. It may also +contain element-specific property maker hashes; these are based on the +local name of the flow object, ie. table-row, not +fo:table-row. If an element-specific property mapping exists, +it is preferred to the generic mapping.
+The base class for all
+properties is Property, and all the property makers extend
+Property.Maker. A more complete discussion of the property
+architecture may be found in
The Refinement step is part of reading and using the properties which may happen immediately or during the layout process.
+During XML Parsing, the FO tree is constructed. For each FO object (some subclass of FObj), the tree builder then passes the list of all attributes specified on the FO element to the handleAttrs method. This -- 2.39.5