使用CXF时,如何处理WS输出中的无效字符?
我正在使用Spring,CXF和Hibernate来构建一个WebService,该服务对具有只读访问权限的外部数据库执行搜索查询。
问题在于,数据库中的某些条目在文本字段中具有奇怪的字符(0x2),并且似乎CXF或它用于处理/序列化从Hibernate会话返回的对象的库(Aegis?)无法处理它:
org.apache.cxf.aegis.DatabindingException: Error writing document.. Nested exception is com.ctc.wstx.exc.WstxIOException: Invalid white space character (0x2) in text to output (in xml 1.1, could output as a character entity)
我该如何解决这个问题?理想情况下,我可以删除这些字符,因为它们对我的输出无关紧要......谢谢!