You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Darrel Riekhof <da...@tririga.com> on 2002/07/01 21:01:27 UTC

Producing Input XML file for Xalan/Fop

Here's the approach we've taken.  We had already written a lot of 'helper' classes that stored data.  These classes are basically JavaBeans, a bunch of getter/setter methods that store most of data we needed in our reports.  We also already had the middleware in place to go against the db and fill these helper objects, they are used in other parts of our webapp.  So, we decided to write a custom Java-Object-to-XML class that calls all of an object's getXxx and isXxx methods and puts the results of the method calls inbetween xml tags.  For instance, if the helper class has a method like this:

	public String getFoo() { ... }

Then it will generate XML like this:

	<foo>bar</foo>

It also handles a few special cases like Collections and recursively calling itself on methods that return objects.  It has some problems, circular refs, escaping stuff, etc, but its working ok for us right now.

How are other people doing this kind of thing?  Is there a popular configurable opensource package that does this kind of thing, converts Java Objects to XML?

Darrel