From: William Victor Mote 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.
+To the extent possible, validation is checked as the FO Tree is built. An appropriate error message is returned to the user, and processing continues if possible.
Elements from foreign namespaces that are recognized by FOP fall into the following categories:
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 root element keeps these objects 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 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 elements within the flow of a page-sequence are those that are needed for the layout process. +These element will later be used to create areas in the layout process.
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.
+Each is handled by its parent element. +The root handles declarations, and declarations maintains a list of colour profiles. +The page-sequences are direct descendants of root.The base class for all objects in the tree is FONode. The base class for -all FO Objects is FObj.
-The class inheritance described above only describes the nature of the -content. Every FO in FOP also has a parent, and a Vector of children. The -parent attribute (in the Java sense), in particular, is used to enforce -constraints required by the FO hierarchy.
-FONode, among other things, ensures that FO's have a parent and that they -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.*.
-
Each FO in FOP has a parent (except root) and a Vector of children. Java inheritance (superclasses and subclasses) is used to enforce constraints required by the FO hierarchy.
+FONode, among other things, ensures that each FO has a parent, and provides the mechanism for keeping track of its children.
+Each xml element is represented by a java object. +The classes for these objects are grouped into packages for convenience:
+org.apache.fop.fo.pagination.*
org.apache.fop.fo.flow.*
org.apache.fop.fo.*.
There is a class for each element in the FO set. An object is created for -each element in the FO Tree. This object holds the properties for the FO -Object.
-Some validity checking is done during these steps. The user can be warned of the error and processing can continue if possible.
-When the object is created it is setup.
-It is given its element name, the FOUserAgent - for resolving properties etc. - the logger and the attributes.
-The methods handleAttributes()
and setuserAgent()
, common to FONode
, are used in this process.
-The object will then be given any text data or child elements.
-Then the end()
method is called.
-The end method is used by a number of elements to indicate that it can do certain processing since all the children have been added.
An FO maker is read from a hashmap lookup using the namespace and -element name. This maker is then used to create a new class that -represents an FO element. This is then added to the FO tree as a child -of the current parent.
+The process of creating an FO Object is as follows (see FOTreeBuilder.startElement()
for details):
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 -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
-Foreign XML will usually be in an fo:instream-foreign-object. +The XML will be passed to the renderer as a DOM, which is expected to know how to handle it. +XML from an unknown namespace will be ignored.
+See Input Parsing Namespaces for more discussion and links to information about using foreign XML in FOP.
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.
+If an element is in a known namespace but the element is unknown within that namespace, then an Unknown object is created. +This generally indicates an input error: perhaps an element from an older version of the XSL-FO standard, or a misspelling. +The Unknown object is mainly used to provide information to the user.