And finally, I'd like to run your problem through the code generator
myself. Can you please create a new Jira issue and attaach all relevant
files to it (though please try to keep things as minimal as possible).
Werner
[EMAIL PROTECTED] wrote:
hi
I guess the issue is that when I analyse the Descriptor for the
ArrayOfAccount object, the descriptor gives no information about the
actual type of array element. So I have no programmatic means of
determining what the underlying type of element that is stored in the
ArrayOfAccount. All I can do with the ArrayOfAccountDescriptor is
obtain a XMLFieldDescriptor for anyObject - the holder in the
ArrayOfAccount instance itself that holds the array elements.
If I use wsdl2j in the Axis stuff, I do manage to get information about
the underlying array element type. This is a bit different in that the
ArrayOfAccount class object has a method that allows an instance to
return the contains elements - but using Java reflection you can find
out that the method returns an array of Account types, which is just fine.
So I am wondering how I can use Castor to programmatically determine the
type of the underlying array element when using array types in XSDs.
Ideally I want tofind ou tthat the ArrayOfAccount object holds elements
of type Account. Now when castor parses the xsd file, it correctly
creates Array class objects - just straight >from the schema. I am just
trying to write some code that allows me to take a top level schema type
def and 'walk' the hierarchy of nested types.
Any clues? Am I explaining my self well enough?
thanks
chris
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris Jobson
Staff Software Engineer
Sybase (UK) Limited
Telephone number +44 (0)1628 597263
Fax number +44 (0)1628 597319
Sybase (UK) Limited, Sybase Court, Crown Lane, Maidenhead, Berkshire SL6
8QZ is a company incorporated in England & Wales under company
registration number 2175260.
NOTICE: This e-mail message and all attachments transmitted with it are
intended solely for the use of the addressee and may contain
confidential information and may be protected by the attorney-client
privilege. If the reader of this message is not the intended recipient,
or an employee or agent responsible for delivering the message to the
intended recipient, you are hereby notified that any dissemination,
distribution, copying or other use of this communication or its
attachments is strictly prohibited. If you have received this
communication in error, please notify the sender immediately by replying
to this message and please immediately delete it from your computer.
*Werner Guttmann <[EMAIL PROTECTED]>*
16/11/2007 18:47
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: [castor-user] Schema arrays, arrayTypes and Java Source code
generation
Hi Christopher,
I am not sure I fully understand the problem .. :-(. Do you have
problems with e.g. unmarshalling, using the classes generated by
Castor's code generator ? Or am I mis-reading something completely ?
Werner
[EMAIL PROTECTED] wrote:
>
> hi
>
> I am fairly new to castor, so I hope this is not a silly question ...
>
> I want to generate java classes from a schema, part of which is
>
> <xsd:schema elementFormDefault="qualified"
>
xmlns:xsdLocal0="http://www.siebel.com/xml/Account%20Interface"
> attributeFormDefault="unqualified"
>
targetNamespace="http://www.siebel.com/xml/Account%20Interface"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> ...
>
> <xsd:complexType name="ListOfAccountInterface">
> <xsd:sequence>
> <xsd:element name="Account" maxOccurs="1" minOccurs="0"
> type="xsdLocal0:ArrayOfAccount">
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="ArrayOfAccount">
> <xsd:complexContent mixed="false">
> <xsd:restriction base="soapenc:Array">
> <xsd:attribute aPrefix:arrayType="xsdLocal0:Account[]"
> ref="soapenc:arrayType" xmlns:aPrefix="http://schemas.xmlsoap.org/wsdl/">
> </xsd:attribute>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="Account">
> <xsd:sequence>
> <xsd:element name="AccountId" maxOccurs="1" minOccurs="0"
> type="xsd:string"></xsd:element>
> <xsd:element name="AccountStatus" maxOccurs="1" minOccurs="0"
> type="xsd:string"></xsd:element>
> ...
> </xsd:complexType>
>
> </xsd:schema>
>
> Now, castor builds me a bunch of java classes as expected, plus the
> associated Descriptors. The trouble I have is with the ArrayOfAccount
> class. The descriptor that is built tells me that it is an array, but
> not what the *type* of the array element is. All I can extract >from
> the ArrayOfAccountDescriptor call is an XMLFieldDescriptor for the
> _arrayType field, but there is nothing in that that indicates that the
> underlying array item is of type Account. The WSDL, however, does tell
> me that the ArrayOfAccount type contains am array of Account type items.
> But I guess this is done through the restriction definition that is
> associated witht he ArrayOfAccount type definition.
>
> Is there anything I can do in the codegenstep that would insert extra
> meta data info inthe Descriptor class that would enable me
> programmatically to determine the Array Type ?
>
> I am not sure how castor figures out that ArrayOfAccount is an array to
> start with, so am unsure how to get it to determine the correct array
here.
>
> Any pointers would be much appreciated !
>
> thanks
>
> chris
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email