For now the best you can do is make them all optional - which means you won't get an error if none or more than one are present in the XML, but at least will handle the case of proper XML input. <xs:choice> does seem worth supporting directly, and I'll enter an enhancement item to add support for this in beta 4. That's not a guarantee it'll be there, but I'll at least look into it.

- Dennis

Guillaume Pothier wrote:

I have an element defined as follows:
<xs:complexType name="TType">
        <xs:choice>
                <xs:element name="primitiveType" type="TPrimitiveType"/>
                <xs:element name="dataType" type="TDataType"/>
                <xs:element name="activityType" type="TActivityType"/>
                (...)
        </xs:choice>
</xs:complexType>

Other binding frameworks (JAXB, and from what I understood a a previous post in this list, Castor as well) usually generate classes with a structure like this:
class Type
{
private PrimitiveType itsPrimitiveType;
private DataType itsDataType;
private ActivityType itsActivityType;
(...)
}


with only one of these fields having a non-null value.

But I have a class like this:
class Type
{
        private TypeStrategy itsStrategy;
}

PrimitiveType, DataType and ActivityType... implementing TypeStrategy.

I did not find a way to define a mapping for this kind of element. Right now, I am solving it with a custom marshaller/unmarshaller. This is not complicated at all, but I would prefer to avoid that.
Did I miss something and is there already a way to define such a binding in xml?
Or is it planned to support that kind of bindings?


Guillaume



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users




-- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197




------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to