What is the Jaxb equivalent of a Text node value?

女生的网名这么多〃 提交于 2019-12-03 10:34:00
jarnbjo

I'm not 100% sure about this, but try to use an @XmlValue annotation instead of @XmlElement.

It looks like the question was referring to text nodes not CDATA nodes, but here is a link on how EclipseLink JAXB (MOXy) handles CDATA:

This documentation writes:

Q. How can I cause the Marshaller to generate CDATA blocks?

A. This functionality is not available from JAXB directly, but you can configure an Apache Xerces-J XMLSerializer to produce CDATA blocks. Please review the JaxbCDATASample.java sample app for more detail.

(btw, this does not answer your particular question, but since the question title is misleading, and this is the first google result for jaxb CDATA, I'm answering a bit different question)

JAXB does not support marshaling/marshaling to/from CDATA xml types.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!