Hi Andreas, Jeremias, Andreas Delmelle wrote: <snip/> > [Vincent:] >>> Using a TransformerFactory just to serialize data into an XML file may >>> sound a bit weird (this has nothing to do with XSLT). It appears that >>> Xerces defines an XMLSerializer class dedicated to that. > <snip /> > > It's not weird at all, if you look at what is needed to serialize your > data into a different format --possibly non-XML. > Using the XMLSerializer, you would either: > a) need a different sort of Serializer (properietary?) > b) if the target is still XML, you /could/ add an XSLT step before the > serialization > > Now, looking at it this way, why not simply use an identity Transformer > to begin with. If your output target changes, all you need to do is > write a stylesheet (which is much simpler than implementing your own > Serializer), and alter one or two lines of Java code (some more if you > also want the stylesheet to be pluggable).
Thanks for the links and explanations. I tended to find the XMLSerializer idea quite elegant, but indeed this is not a very big deal to use TrAX (I guess the creation of the TransformerHandler can be encapsulated anyway), and also probably more flexible. Vincent -- Vincent Hennebert Anyware Technologies http://people.apache.org/~vhennebert http://www.anyware-tech.com Apache FOP Committer FOP Development/Consulting
