Hi Scott,
Please read the following:
http://castor.exolab.org/sourcegen.html#Class-Creation/Mapping
...and then choose the "type" method.
For more information on type-centric or element-centric data binding you
can also read Chapter 15 (and more specifically the source generator
section of that chapter) of Professional XML 2nd Edition, from Wrox
Publishsing, Inc. There is a link to this chapter on our website:
http://castor.exolab.org/presentations.html
Thanks,
--Keith
"Dunn, Scott" wrote:
>
> I apologise if this is a known problem, but I was unable to figure how to
> characterise this in order to search the mail archives.
>
> I am trying to do something like the following:
>
> <xsd:complexType name="PurchaseOrderType">
> <xsd:sequence>
> <xsd:element name="shipTo" type="USAddress"/>
> <xsd:element name="billTo" type="USAddress"/>
> </xsd:sequence>
> </xsd:complexType>
>
> Where a complexType contains two elements of the same type. I expected that
> the generated Java source would look like:
>
> public class PurchaseOrderType {
>
> USAddress _shipTo;
> USAddress _billTo;
> ...
> }
>
> Instead it looks like:
>
> public class PurchaseOrderType {
>
> ShipTo _shipTo;
> BillTo _billTo;
> ...
> }
>
> There is no definition for a ShipTo or BillTo type anywhere in my schema so
> the type field seems to be pretty much ignored.
>
> The XML Primer (http://www.w3.org/TR/xmlschema-0/#po.xsd) contains a
> complete schema that demonstrates this problem. Is this a known or
> acknowledged problem and is there a fix planned or available?
>
> The Castor Source Code Generator User Document does imply that the schema
> above should work as I interpret it. The following extract from the doc
> suggests that the 'type' field of the <element> does actually get used when
> generating the setter.
>
> <complexType>
> <element name="products" type="product" minOccurs="0" maxOccurs=
> "unbounded">
> </complexType>
>
> public void setProducts(Product[] productArray) {
>
> }
>
> Thanks,
>
> Scott.
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev