users@jaxb.java.net

XJC frustration

From: Brian Pontarelli <brian_at_pontarelli.com>
Date: Sat, 24 Mar 2007 11:28:17 -0600

Just wanted to put this out on the list because I spent a number of
hours trying to get XJC to play nice and finally gave up in favor of
hand coding because it just would not get with the program. I have this:

  <xs:complexType name="entry" mixed="true">
    <xs:sequence>
      <xs:element name="phrase" type="xs:string" minOccurs="1"
maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>


and no matter if I changed the type of the "phrase" element to a complex
type, or a simple type or just used the inline schema types like this it
would generate this code:

    @XmlElementRef(name = "phrase", namespace =
"http://www.inversoft.com/schemas/profanity-1.0/database", type =
JAXBElement.class)
    @XmlMixed
    protected List<Serializable> content;

This obviously sucks really bad because it doesn't provide a clean OO
API. So, after much battling I gave up and changed it to this:

    @XmlElement(name = "phrase")
    private String phrase;

This works fine, but hand coding sucks as well. Anyone have solutions?
Any fix coming for the next JDK 1.6 release?

-bp