users@jaxb.java.net

Re: JAXB generated java beans not generated in proper heirarchy based on xsd:extension

From: harsh marwaha <harsh.marwaha1_at_gmail.com>
Date: Fri, 24 Feb 2012 08:04:08 -0500

I was able resolve the issue by providing the following binding:

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings
 xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
 xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc">
  <jaxb:globalBindings generateMixedExtensions="true"/>
</jaxb:bindings>

It seems that mixed content was the issue. I am unable to shared the
complete schema.

Thanks
Harsh

On Fri, Feb 24, 2012 at 12:44 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com>wrote:

> Please provide a complete XML Schema, i.e., one that compiles using xjc and
> exhibits the problem. From your snippet, ANY is missing.
> -W
>
>
> On 24 February 2012 03:15, <harsh.marwaha1_at_gmail.com> wrote:
>
>> Here is the snippet of my schema:
>>
>> <xs:complexType name="EN" mixed="true">
>> <xs:annotation>
>> <xs:documentation>
>> A name for a person, organization, place or thing. A
>> sequence of name parts, such as given name or family
>> name, prefix, suffix, etc. Examples for entity name
>> values are "Jim Bob Walton, Jr.", "Health Level Seven,
>> Inc.", "Lake Tahoe", etc. An entity name may be as simple
>> as a character string or may consist of several entity name
>> parts, such as, "Jim", "Bob", "Walton", and "Jr.", "Health
>> Level Seven" and "Inc.", "Lake" and "Tahoe".
>> </xs:documentation>
>> </xs:annotation>
>> <xs:complexContent mixed="true">
>> <xs:extension base="ANY">
>> <xs:sequence>
>> <xs:choice minOccurs="0"
>> maxOccurs="unbounded">
>> <xs:element
>> name="delimiter" type="en.delimiter"/>
>> <xs:element
>> name="family" type="en.family"/>
>> <xs:element
>> name="given" type="en.given"/>
>> <xs:element
>> name="prefix" type="en.prefix"/>
>> <xs:element
>> name="suffix" type="en.suffix"/>
>> </xs:choice>
>> <xs:element name="validTime"
>> type="IVL_TS" minOccurs="0">
>> <xs:annotation>
>>
>> <xs:documentation>
>> An interval of time specifying the time during
>> which
>> the name is or was used for the entity. This
>> accomodates the fact that people change names
>> for
>> people, places and things.
>> </xs:documentation>
>> </xs:annotation>
>> </xs:element>
>> </xs:sequence>
>> <xs:attribute name="use"
>> type="set_EntityNameUse" use="optional">
>> <xs:annotation>
>> <xs:documentation>
>> A set of codes advising a system or user which
>> name
>> in a set of like names to select for a given
>> purpose.
>> A name without specific use code might be a
>> default
>> name useful for any purpose, but a name with a
>> specific
>> use code would be preferred for that respective
>> purpose.
>> </xs:documentation>
>> </xs:annotation>
>> </xs:attribute>
>> </xs:extension>
>> </xs:complexContent>
>> </xs:complexType>
>>
>> and here is the generated JAXB bean:
>>
>> @XmlAccessorType(XmlAccessType.FIELD)
>> @XmlType(name = "EN", propOrder = {
>> "content"
>> })
>> @XmlSeeAlso({
>> ON.class,
>> PN.class,
>> TN.class
>> })
>> public class EN {
>>
>> @XmlElementRefs({
>> @XmlElementRef(name = "prefix", namespace = "urn:hl7-org:v3",
>> type = JAXBElement.class),
>> @XmlElementRef(name = "validTime", namespace =
>> "urn:hl7-org:v3", type = JAXBElement.class),
>> @XmlElementRef(name = "delimiter", namespace =
>> "urn:hl7-org:v3", type = JAXBElement.class),
>> @XmlElementRef(name = "given", namespace = "urn:hl7-org:v3",
>> type = JAXBElement.class),
>> @XmlElementRef(name = "suffix", namespace = "urn:hl7-org:v3",
>> type = JAXBElement.class),
>> @XmlElementRef(name = "family", namespace = "urn:hl7-org:v3",
>> type = JAXBElement.class)
>> })
>> @XmlMixed
>> protected List<Serializable> content;
>> @XmlAttribute
>>
>> Based on the schema EN class should extend from ANY class, but it does
>> not.
>>
>> Any clues?
>>
>> Thanks
>>
>
>