I need to generate a number of XML documents from Java objects. The objects are deep ORM mapped objects, and the XML documents are for a search index (a la Lucene). I want to be able to create a configuration file and feed it a Java object and have it spit out the XML specified in the configuration. Ideally the configuration would consist of a mapping of (possibly deep) properties on the java side to XPath or something very much like it on the XML side.
JAXB is unsuitable because it wants to the create a one to one mapping from object data to XML nodes. I've looked at JIBX and XStream but neither of them seem to be designed to do what I'm talking about.
Essentially what I want is Dozer, but designed to create an XML document as its target rather than another Java bean. From my research so far it looks like I'm going to have to write this myself. Can anyone offer a better alternative?
EDIT: The solution must not be predicated on the ability to modify the source Java files. Annotation based systems are comepletely useless to my purposes here. It should be possible to define 'translators' for the individual mappings just as it is in Dozer.
It should be noted that I need to be able to specify that a given input field in java might be output in several different places in the XML output, perhaps being transformed in some cases and not in others.
I've already considered doing some sort of straight Java to XML translation of the objects and then performing my task using XSLT, but the problem with that is that these are deep objects with bidirectional connections. Any mapping of the objects to XML would have a difficult time figuring out how deep in object hierarchy to go, even if it could keep track of which objects should be discounted because they'd been seen already.