Yes, but in that post Dennis says that currently element substitution groups are supported in JiBX. So if you define a substitution group in your schema, maybe your problem will be solved. See for example this page http://www.stylusstudio.com/w3c/schema0/SubsGroups.htm#SubsGroups for information on substitution groups..
Haggie, Tom wrote: > Tried that - no effect. > > I've found this: > http://www.nabble.com/status-of-inheritance-and-polymorphism-td22430332. > html > > Which implies that it won't be supported till 2.0 :o( > > -*TOM*- > > -----Original Message----- > From: Serkan Camurcuoglu [mailto:serkan.camurcuo...@telenity.com] > Sent: June 3, 2009 11:48 AM > To: JiBX users > Subject: [LIKELY JUNK]Re: [jibx-users] [LIKELY JUNK]Re: JiBX and > inheritence > > there is only one element in your xsd (which is the Values element), all > > others are complexTypes, but not elements. Therefore, codegen generates > only abstract mappings for your types. For example, you should add an > element named StringValue which has the (complex) type stringValue. The > same is also true for doubleValue. If you re-execute codegen after that, > > I think then codegen will generate a correct binding for you. > > regards, > > SerkanC > > > > > Haggie, Tom wrote: > >> It's generated from the schema by codegen: >> <binding xmlns:tns="http://test.com/test/me" name="binding" >> package="com.test.test.me"> >> <namespace uri="http://test.com/test/me" default="elements"/> >> <mapping abstract="true" type-name="tns:stringValue" >> class="com.test.test.me.StringValue"> >> <structure map-as="tns:value"/> >> <value style="attribute" name="txt" get-method="getTxt" >> set-method="setTxt" usage="optional"/> >> </mapping> >> <mapping abstract="true" type-name="tns:doubleValue" >> class="com.test.test.me.DoubleValue"> >> <structure map-as="tns:value"/> >> <value style="attribute" name="dbl" get-method="getDbl" >> set-method="setDbl" usage="optional"/> >> </mapping> >> <mapping abstract="true" type-name="tns:value" >> class="com.test.test.me.Value"/> >> <mapping abstract="true" type-name="tns:values" >> class="com.test.test.me.Values"> >> <collection get-method="getValues" set-method="setValues" >> create-type="java.util.ArrayList"> >> <structure map-as="tns:value" name="Value"/> >> </collection> >> </mapping> >> <mapping class="com.test.test.me.Values" name="Values"> >> <structure map-as="tns:values"/> >> </mapping> >> </binding> >> >> -----Original Message----- >> From: Serkan Camurcuoglu [mailto:serkan.camurcuo...@telenity.com] >> Sent: June 3, 2009 11:22 AM >> To: JiBX users >> Subject: [LIKELY JUNK]Re: [jibx-users] JiBX and inheritence >> >> how about your binding xml? >> >> >> >> Haggie, Tom wrote: >> >> >>> This is a duplicate of my previous mail, I've modified it to remove >>> the term polymorphism since I think that term might be why no-one >>> responded to what must be common, simple and obvious. >>> >>> I have complex types which extend a base type, when I add them to a >>> collection and serialize them it just serializes them as the base >>> types, not the sub types: >>> >>> The XSD: >>> >>> <xs:complexType name=/"stringValue"/> >>> >>> <xs:complexContent> >>> >>> <xs:extension base=/"value"/> >>> >>> <xs:attribute name=/"txt"/ type=/"xs:string"/ /> >>> >>> </xs:extension> >>> >>> </xs:complexContent> >>> >>> </xs:complexType> >>> >>> <xs:complexType name=/"doubleValue"/> >>> >>> <xs:complexContent> >>> >>> <xs:extension base=/"value"/> >>> >>> <xs:attribute name=/"dbl"/ type=/"xs:double"/ /> >>> >>> </xs:extension> >>> >>> </xs:complexContent> >>> >>> </xs:complexType> >>> >>> <xs:complexType name=/"value"/> >>> >>> </xs:complexType> >>> >>> <xs:complexType name=/"values"/> >>> >>> <xs:sequence minOccurs=/"0"/ maxOccurs=/"unbounded"/> >>> >>> <xs:element name=/"Value"/ type=/"value"/ /> >>> >>> </xs:sequence> >>> >>> </xs:complexType> >>> >>> <xs:element name=/"Values"/ type=/"values"/ /> >>> >>> The Java: >>> >>> StringValue sv = *new* StringValue(); >>> >>> sv.setTxt(_"Foo"_); >>> >>> DoubleValue dv = *new* DoubleValue(); >>> >>> dv.setDbl(_3.141_); >>> >>> Values values = *new* Values(); >>> >>> List<Value> valueList = values.getValues(); >>> >>> valueList.add(sv); >>> >>> valueList.add(dv); >>> >>> String xmlString = /toXMLString/(values); >>> >>> System./out/.println(xmlString); >>> >>> The output: >>> >>> <Values xmlns="http://test.com/test/me"> >>> >>> <Value/> >>> >>> <Value/> >>> >>> </Values> >>> >>> Is there something obvious that I'm doing wrong - or is this just not >>> > > >>> possible (given that it generates the types correctly one would >>> > assume > >>> >>> >> >> >>> that this is supposed to work? >>> >>> Thanks >>> >>> -*TOM*- >>> >>> >>> >>> > ------------------------------------------------------------------------ > >> >> >>> >>> > ------------------------------------------------------------------------ > >> ------ >> >> >>> OpenSolaris 2009.06 is a cutting edge operating system for >>> > enterprises > >>> >>> >> >> >>> looking to deploy the next generation of Solaris that includes the >>> >>> >> latest >> >> >>> innovations from Sun and the OpenSource community. Download a copy >>> > and > >>> >>> >> >> >>> enjoy capabilities such as Networking, Storage and Virtualization. >>> Go to: http://p.sf.net/sfu/opensolaris-get >>> >>> >>> > ------------------------------------------------------------------------ > >> >> >>> _______________________________________________ >>> jibx-users mailing list >>> jibx-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/jibx-users >>> >>> >>> >> >> > ------------------------------------------------------------------------ > >> ------ >> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >> > > >> looking to deploy the next generation of Solaris that includes the >> latest >> innovations from Sun and the OpenSource community. Download a copy and >> > > >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to: http://p.sf.net/sfu/opensolaris-get >> _______________________________________________ >> jibx-users mailing list >> jibx-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jibx-users >> >> >> > ------------------------------------------------------------------------ > ------ > >> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >> > > >> looking to deploy the next generation of Solaris that includes the >> > latest > >> innovations from Sun and the OpenSource community. Download a copy and >> > > >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to: http://p.sf.net/sfu/opensolaris-get >> _______________________________________________ >> jibx-users mailing list >> jibx-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jibx-users >> >> > > > ------------------------------------------------------------------------ > ------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users