users@jaxb.java.net

Re: Parse error on unmarshal - upgrading from jaxb 2.0 to jaxb 2.1

From: Glen Mazza <glen.mazza_at_gmail.com>
Date: Sat, 10 Jul 2010 10:42:12 -0400

Some thoughts:

1.) What I'm not clear from your question is whether or not JAXB 2.1 is
incorrectly rejecting the ^@ at the end of the last XML tag during
unmarshalling, or whether JAXB 2.0 was incorrectly accepting it and you
would like to see similar laxity with JAXB 2.1.

2.) Have you tried, via the endorsed standard overrides mechanism,
swapping JAXB 2.2 into your JDK--what happens then?

3.) You said the C module returns this XML with the ^@ ending, and then
you feed it through the JAXB unmarshaller (where you get the error).
Just prior to feeding it, but just after you get the response from the C
module, can you manually strip out those ending characters and then
unmarshall it?

4.) How high on the difficult-o-meter would it be to toss out that C
module and do straight Java?

Glen

ginsohn wrote:
> Hi,
> I have a problem with unmarshaling. I'll describe what I'm trying to do:
>
> My application ran until now with Java 1.5 and jaxb 2.0, and in this a
> particular class I interact with a C process via stdin and stdout,
> marshaling the request (to stdin) from a JAXB object, and unmarshaling the
> response (from stdout) into an object from the same schema. The C process
> adds "std::ends" (^@, represents end of stream, caret+NULL char) to the end
> of the XML response.
>
> I am now upgrading to Java 1.6. I'm doing it for now only at runtime, so I
> re-built the schema with jaxb 2.1 with Java 1.5 compiler, but now the call
> to "unmarshal" fails with the error:
> "javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,14]
> Message: Content is not allowed in trailing section."
>
> It seems that it somehow fails to parse the closing NULL, while before all
> was good. I checked the XML input and output, they look the same as they did
> before. My XSD has not changed either, I only re-built the Java classes with
> jaxb 2.1 libraries.
>
> What am I missing? Please advise, thanks
>