Hi Jeremias,
As far as I understand the event-model.xml and test-event-model.xml
files are automatically generated at build time. Is there any reason to
put them under version control then?
And this one is more to myself, to be sure I understand how things are
working. At several places you do something like this:
SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
But the SAXTransformerFactory class doesn’t re-define the newInstance
method, which then is taken from TransformerFactory. AFAIU, to be sure
it will create a SAXTransformerFactory instance you need to play with
the "javax.xml.transform.TransformerFactory" system property. Which IIC
is not done anywhere, so it relies on the platform default, which
obviously happens to actually create a SAXTransformerFactory. It’s ok,
I’d just like to know if I am right in my assumptions?
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. Basically the
following:
Result res = new StreamResult(outputFile);
SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
TransformerHandler handler = tFactory.newTransformerHandler();
Transformer transformer = handler.getTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
handler.setResult(res);
handler.startDocument();
object.toSAX(handler);
handler.endDocument();
would be replaced by the following:
ContentHandler handler = new XMLSerializer(new FileWriter(outputFile),
new OutputFormat("xml", "UTF-8", true));
handler.startDocument();
object.toSAX(handler);
handler.endDocument();
Since we have switched to Java 1.4 as a minimum requirement, the
xercesImpl dependency is no longer required, but since we have it
already, why not keeping it for that. WDYT?
Thanks,
Vincent
--
Vincent Hennebert Anyware Technologies
http://people.apache.org/~vhennebert http://www.anyware-tech.com
Apache FOP Committer FOP Development/Consulting