xerces serialization in Java 6
Posted
by Jim Garrison
on Stack Overflow
See other posts from Stack Overflow
or by Jim Garrison
Published on 2010-05-24T17:11:01Z
Indexed on
2010/05/24
17:21 UTC
Read the original article
Hit count: 333
In Java 6, the entire xerces XML parser/serializer implementation is now in the Java runtime (rt.jar). The packages have been moved under the com.sun.* namespace, which places them off-limits for explicit reference within client code. This is not a problem when using the parser, which is instantiated via javax API-defined factories.
However, our code also uses xerces serialization (org.apache.xml.serialize.* ). AFAICT, there are no javax.xml API-defined factories for creating instances of Serializer and OutputFormat. This seems to imply that the only way to get one is to explicitly call the com.sun.org.apache.xml.serialize.* APIs.
I've found the serialization classes in javax.xml.stream, but they don't seem to provide any output-formatting control like the xerces OutputFormat class.
Question:
Is there a way to access the xerces serialization functionality (which is in rt.jar) via a javax standard API, without including xerces.jar and also without explicitly instantiating com.sun.* classes?
If not, is there an javax API-compliant way to achieve the same effect?
© Stack Overflow or respective owner