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