Arnaud, Here is the situation:
I am not _directly_ creating elements (in the XML schema) from
some of my complexTypes because they are _derived_ (subclass)
types, declared using <xsd:extension base=...>
Here's the relevant part of the schema:
<xsd:schema xmlns:xsd=
"http://www.w3.org/2000/10/XMLSchema"
targetNamespace=
"http://zzzzzyyyy.com/OurCurrentProject">
<xsd:include schemaLocation="MyClass.xsd"/>
<xsd:complexType name="MyClass">
<xsd:complexContent>
<xsd:extension base="AParentClass">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
In the above, I want the generated Java code to create code that
says MyClass extends AParentClass. This _is_ happening. However,
the next thing I want to do is to create an _instance_ of MyClass
in my Java code. Of course this fails since MyClass is abstract.
I am using the 'element' method. When I used the 'type' method,
we could create class instances (since they were not abstract)
and they marshaled out just fine, but had class cast problems
when trying to unmarshal.
>--- Original Message ---
>From: "Arnaud Blandin" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Date: 9/10/01 1:50:21 PM
>
>Hi Miles,
>
>it is strange: are you defining complexTypes that are not used
by elements, I
>mean
>if you have in your schema something like:
><complextype name="foo".....>
>.....
>and no element of type foo, then you should use the 'type' method
to
>use the generated classes.
>if you have
><complextype name="foo".....>
><element name="bar" type="foo">
>then using the element method will generate
>public class Bar extends Foo and there is no sense in using
Foo directly.
>You can extend it by yourself but it is not a real good practice.
>
>I hope I succeed into helping you,
>
>Arnaud
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, September 10, 2001 6:53 AM
>> To: [EMAIL PROTECTED]
>> Subject: RE: Re: [castor-dev] sourceGen: abstract java classes
>>
>>
>>
>>
>> Arnaud,
>> Thank you very much for writing. I am sorry; I still don't
>> understand. How can I use these generated classes? Do I
have
>> to derive from them myself? I cannot even create an XML document
>> from them as they are, since obviously they cannot be constructed.
>> Is there an example of how to use these?
>> Miles Whitener
>>
>> >--- Original Message ---
>> >From: "Arnaud Blandin" <[EMAIL PROTECTED]>
>> >To: [EMAIL PROTECTED]
>> >Date: 9/9/01 7:01:42 PM
>> >
>>
>> >Hi Miles,
>> >
>> >when using the 'element' method, abstract classes are created
>> >for representing complex types.
>> >Since when using this method, you are looking from the XML
point
>> of
>> >view (you are describing the XML document with your java
classes,
>> not
>> >your XML Schema), there is no sense in unmarshalling a complexType.
>> This is
>> >the reason why you won't find any unmarshall() method.
>> >These classes are extended by elements of type the complex
type.
>> In
>> >this extended classes, you'll find the unmarshall method.
>> >
>> >Hope this helps,
>> >
>> >Arnaud
>> >
>> >> -----Original Message-----
>> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>> >> Sent: Friday, September 07, 2001 4:53 PM
>> >> To: [EMAIL PROTECTED]
>> >> Subject: [castor-dev] sourceGen: abstract java classes
>> >>
>> >>
>> >>
>> >>
>> >> How can the abstract classes generated using the "element"
>> method
>> >> be utilized? I have some generated classes that have two
>> problems:
>> >> 1. all of the marshal( ) methods are abstract, and 2. there
>> is
>> >> no unmarshal( ) method declared at all!
>> >>
>> >> Note: I am using inheritance via <xsd:extension base="...">.
>> >>
>> >> What can these generated classes be used for? If I have
to
>> write
>> >> marshal( ) and unmarshal( ) myself, then what is Castor
doing
>> >> for me?
>> >>
>> >> Thanks in advance.
>> >>
>> >> -----------------------------------------------------------
>>
>> >> 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
>> >
>>
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev