Hello,

I am using castor 1.1.2 on Java >= 5 and would like to avoid shipping an
extra Xerces with my application. Therefore, I unset the
org.exolab.castor.parser property so that castor looks for a parser
through JAXP and I set the org.exolab.castor.xml.serializer.factory
property to org.exolab.castor.xml.XercesJDK5XMLSerializerFactory.
Unfortunately, XercesJDK5XMLSerializerFactory explicitly uses the
non-public com.sun.org.apache.xml.internal.serialize package. Therefore,
it might not work on future Java versions or non-Sun java
implementations. I wondered if it was not possible to write an
XMLSerializerFactory that uses just the public API of Java 5. It seems
to me that this can be done rather easily using the javax.xml.transform,
javax.xml.transform.stream and javax.xml.transform.sax packages.
org.exolab.castor.xml.XMLSerializerFactory ->
javax.xml.transform.sax.SAXTransformerFactory.
(getSerializer() -> newTransformerHandler())
org.exolab.castor.xml.Serializer ->
javax.xml.transform.sax.TransformerHandler +
javax.xml.transform.stream.StreamResult
Almost all the OutputFormat properties can be found in
javax.xml.transform.OutputKeys and can be set on TransformerHandler with
getTransformer().setOutputProperty().

If no-one else wants to try I might do so myself, so please tell me what
you think of the idea.
Best regards,
M. Ringler

 



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to