jaxb-ri
jaxb-ri copied to clipboard
FAQ answer on CDATA uses deprecated solution
https://jaxb.dev.java.net/faq/index.html#marshalling_cdata suggests using Apache Xerces-J XMLSerializer, which is deprecated as of version 2.9.
Is there another method of achieving the same results that isn't deprecated?
Environment
Operating System: All Platform: All
Affected Versions
[2.1.12]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/682
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by jpleed3
@glassfishrobot Commented tjstavenger said: Xerces-J offers the following replacements for the classes in the org.apache.xml.serialize package: http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
However, from what I can tell, neither the LSSerializer nor the Transformer classes fit well into the JAXB API. In particular, neither implement the ContentHandler interface to change the text elements to CDATA while marshalling.
This leaves an implementation with two options:
1. Use the Sun internal implementation at com.sun.org.apache.xml.internal.serialize
2. Use the deprecated Xerces-J implementation
Neither of which are good solutions long-term.
@glassfishrobot Commented Was assigned to snajper
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-682