users@jaxb.java.net

Set<E> in class causes XMLStreamReaderException

From: David Akhond <hdakhond_at_mac.com>
Date: Wed, 17 Oct 2007 09:33:14 -0700

I am using JAXB 2.1 for a JAX-WS scenario generating from java classes.
It looks like any classes that do not include a Set collection work
fine, but when the XML generated for any class containing a member
that has a Set collection is sent I get the following error:

com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error:
java.xml.stream.XMLStreamException: ParseError at [row,col]: [1,95]
Message: XML document structures must start and end within the same
entity.

Using a similar class with a List<> member instead of the Set<>
member does not cause this problem.
I created an XMLAdapter<> for the troublesome Set member and I can
watch the marshal() method get called and convert the collection to a
List but I still get the same exception.

I looked at the generated xsd for the class and it looks fine, a
sequence is generated for the member whether it is a Set<> or List<>.

Has anyone else seen this behavior?