users@jaxb.java.net

Re: ComplexContent Extensions

From: Canning, Chuck <chuck.canning_at_zilliant.com>
Date: Thu, 27 Mar 2003 13:53:53 -0600

Hey,

The only way to get it to return one element instead of a list is to have
the choices extend the same base type. That will be difficult from your
example. Currently, it returns a list because it has an unknown return type.
There may be a more elegant and exact reason, but this should help you.

Chuck

-----Original Message-----
From: Malachi de AElfweald [mailto:malachi_at_EOTI.ORG]
Sent: Thursday, March 27, 2003 1:43 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: ComplexContent Extensions


On Thu, 27 Mar 2003 10:51:47 -0700, Malachi de AElfweald <malachi_at_EOTI.ORG>
wrote:
>And what does this actually do (changed 'content' to 'data' due to the
other change I made):
>
> <jaxb:bindings schemaLocation="dynarray.xsd" node="/xsd:schema">
> <jaxb:bindings node="./xsd:complexType[@name='data']">
> <jaxb:property name="base"/>
> </jaxb:bindings>
> </jaxb:bindings>
>
>
>I thought it changed all references from 'data' to 'base', but the javadocs
don't appear to reflect that kind of change.

Ok, with a little more playing, I think I am starting to understand.
I moved the bindings inline:
 <xsd:complexType name="data" mixed="true">
  <xsd:annotation>
   <xsd:appinfo>
    <jaxb:property name="data"/>
   </xsd:appinfo>
  </xsd:annotation>
  <xsd:choice>
   <xsd:element name="text" type="xsd:string"/>
   <xsd:element name="hex" type="xsd:hexBinary"/>
   <xsd:element name="base64" type="xsd:base64Binary"/>
  </xsd:choice>
 </xsd:complexType>

and it now has the getData() method... which returns a List... which is
because of the choice... Since we only allow it to contain one element, how
do I have it return a single element, instead of a List? I think that is
the reason removing the jaxb:property line causes the Content errors -- it
is trying to remove two different lists, which automatically get the
getContent() name... I think I could get rid of the property name if I
managed to not return a list.

Malachi