diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-01-17 11:07:10 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-01-17 11:07:10 +0000 |
commit | c7d04323247a0d75f773c6fbe00cc1d68844a2e5 (patch) | |
tree | 7f1a575839a1e3fa35417ee97652350e0ff3bd4e /examples/plan | |
parent | f56c315df5921953702f6ab9c2a331ff7c0caa0f (diff) | |
download | xmlgraphics-fop-c7d04323247a0d75f773c6fbe00cc1d68844a2e5.tar.gz xmlgraphics-fop-c7d04323247a0d75f773c6fbe00cc1d68844a2e5.zip |
New feature: "Intermediate format" (IF). The IF is basically the XML dialect written by the area tree renderer (XMLRenderer). A new parser for this format allows reparsing a serialized and possibly modified area tree and rendering it to the final target format. More details on the Wiki at http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml. No advanced features have been implemented, yet, only the basic functionality. The whole change should be fully backwards-compatible WRT the outer FOP API except maybe for FOTreeBuilder.addElementMapping(), and the area tree XML which got small changes.
The area tree has been cleaned up. The serializability has been restored. The CachedRenderPagesModel works again and can, in certain situations, decrease the maximum amount of memory held at one point in time. Some adjustments were necessary in the area tree to help the work of the AreaTreeParser.
The AreaTreeParser is new and is responsible for parsing area tree XML files and adding pages to a RenderPagesModel instance. It is SAX-based and should be pretty efficient.
XMLUnit (http://xmlunit.sourceforge.net, BSD license) is a new dependency for the test code. It is used to verify the correctness of the intermediate format code. It doesn't have to be installed for the build to run through, though.
ElementMapping got a new method getDOMImplementation() which provides the DOMImplementation used to handle a subdocument of a particular namespace. For example, SVG uses Batik's SVG DOM. The AreaTreeParser needs that to properly recreate foreign objects because it can't use the mechanism of the FO tree. The default implementation returns null.
The ElementMapping instances are no longer maintained by the FOTreeBuilder, but by the newly created ElementMappingRegistry class. It is expected that the instance of this class is moved from the FOTreeBuilder and the AreaTreeParser's Handler class to the "environment class" once it is created to cut down on the startup time for each processed document.
The XMLRenderer has been slightly modified to improve the serialization/deserialization qualities of the area tree XML format.
The XMLRenderer can now mimic another renderer (see mimicRenderer(Renderer)) in order to use its font setup. That way it is made certain that the reparsed area tree will render to the final target format exactly as expected.
Fixed a bug in the XMLHandlerRegistry which did not always return the right XMLHandler for every situation.
Added a DefaultErrorListener to the util package. I've had problems with Xalan-J swallowing exceptions with its default ErrorListener, so I added a simple one for convenience and use in AreaTreeParser.
Example code for working with the AreaTreeParser can be found in examples/embedding. Documentation will follow.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@369753 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'examples/plan')
-rw-r--r-- | examples/plan/src/org/apache/fop/plan/PlanElementMapping.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java b/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java index 13d65a3f7..94c6127e5 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java +++ b/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2004,2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,9 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.ElementMapping; import org.apache.fop.image.analyser.XMLReader; import org.apache.fop.image.FopImage; +import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; -import java.util.HashMap; - /** * This class provides the element mapping for FOP. */ @@ -34,10 +33,17 @@ public class PlanElementMapping extends ElementMapping { /** Plan Namespace */ public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/plan"; + /** Main constructor. */ public PlanElementMapping() { this.namespaceURI = NAMESPACE; } + /** @see org.apache.fop.fo.ElementMapping#getDOMImplementation() */ + public DOMImplementation getDOMImplementation() { + return getDefaultDOMImplementation(); + } + + /** @see org.apache.fop.fo.ElementMapping#initialize() */ protected void initialize() { if (foObjs == null) { foObjs = new java.util.HashMap(); |