You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew <su...@gmail.com> on 2011/03/08 23:34:54 UTC

UnmarshalException with Null Character

I'm getting the following error when umarshaling a JAXB object that has a
String with a null character (0x0).  Is is possible to have CXF encode this,
or do I need to cleanse the response of invalid XML characters? Thanks.

Andrew

Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was
found in the element content of the document.]
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:514)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:215)
    at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)

Re: UnmarshalException with Null Character

Posted by Benson Margulies <bi...@gmail.com>.
No. U+0000 is not a valid XML 1.0 character, and there is no escape
mechanism allowed for in XML. The same applies to all of the C0
controls and some other obscurities. This is addressed in XML 1.1, but
no SOAP interoperability standard seems to be moving to XML 1.1.  If
you have to transmit such things, you have to use a representation
other than 'string'.

On Tue, Mar 8, 2011 at 5:34 PM, Andrew <su...@gmail.com> wrote:
> I'm getting the following error when umarshaling a JAXB object that has a
> String with a null character (0x0).  Is is possible to have CXF encode this,
> or do I need to cleanse the response of invalid XML characters? Thanks.
>
> Andrew
>
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was
> found in the element content of the document.]
>    at
> javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
>    at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:514)
>    at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:215)
>    at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
>    at
> javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
>    at
> javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)
>