Caused by: java.lang.ClassCastException
at com.redcrea.ina.core.type.Type.JiBX_all_bindings_marshal_1_0(Type.java)
at com.redcrea.ina.core.type.JiBX_all_bindingsType_access.marshal()
at com.redcrea.ina.core.type.Type.marshal(Type.java)
at org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:907)
at org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:977)
at com.redcrea.ina.tools.jibx.Binder.marshall(Binder.java:72)
at com.redcrea.ina.test.TestTypeBindings.main(TestTypeBindings.java:28)
... 5 more
Which seems logical as JiBX will try to cast my TypeStrategy (which is an interface) into the first concrete class appearing in the binding definition...
Dennis Sosnoski wrote:
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
------------------------------------------------------- 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
