Hi Jason,

I can imagine your motivation for creating a representation of an fo
tree in a java application
however feeding this into FOP directly would perhaps be a little
wastful from FOP's point of view:
FOP uses SAX to parse the fo input and then builds an internal
representation of the FO tree.
This is not just a deserialization of the tree into java beans-
the FO Tree classes provides methods that capture the semantic
complexity of the fo structure,
one that cannot be represented in an .xsd.

Navigating a DOM like structure and then generating the richer FOTree
would promote an extra layer of processing
and memory consumption, and is something we would want to avoid when
dealing with large documents.

This is not to say there is no value with your approach to generating
fo.  Maybe you could navigate your tree and generate sax events
that can be handled by FOP's FOTree builder- I think this can be
achieved in fairly straigt forward way, although I am no expert in
chaining SAX processors.
Perhaps a bit of bridging code maybe required and perhaps FOP would
benefit from this.

Hopefully some one else in the FOP community can confirm my thoughts
here with perhaps a pointer for getting started.


On Fri, Nov 19, 2010 at 4:35 AM, Jason Harrop <jhar...@gmail.com> wrote:
> Hello
> I have used the JAXB tool XJC to generate a set of classes which
> represent 
> http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/foschema/fop.xsd
> As wikipedia explains, "Java Architecture for XML Binding (JAXB)
> allows Java developers to map Java classes to XML representations.
> JAXB provides two main features: the ability to marshal Java objects
> into XML and the inverse, i.e. to unmarshal XML back into Java
> objects".  JAXB is similar to XMLBeans.  It is JSR-222.
> You can see the Java classes for fop.xsd at
> http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/xslfo/org/plutext/jaxb/xslfo/
> My motivation was initially to be able to create somewhat complex
> layout master set; see
> http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/LayoutMasterSetBuilder.java
> I'm planning to publish the code somewhere as a code base independent
> from docx4j.  Is there any interest in having it as part of FOP?
> What if FOP could ingest these Java objects directly (ie without the
> having to be marshalled first)?
> If there is no interest, that's fine.  I'll just put the code on
> Google Code, say.
> cheers . Jason

Reply via email to