Hi Margaret,

That is the standard approach, see my earlier replies to the message.

Thanks for validating that this approach works for you.

--Keith

"Martin, Margaret" wrote:
> 
> Andi -
> The approach that I have taken is to put the existing classes into a
> separate schema that is referenced by the one that I want to generate from,
> then set the namespace mapping to the actual package containing those
> classes in castorbuilder.properties.
> 
> For example, the file ExternalTypes.xsd:
> <xs:schema targetNamespace="http://schemas/test/externalTypes";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>     <xs:complexType name="MyAttributeType"/>
> </xs:schema>
> 
> MySchema.xsd:
> <xs:schema
> targetNamespace="http://www.vignette.com/castor/schemas/test/types";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns:xo="http://schemas/test/externalTypes";>
>         <xs:import namespace="http://schemas/test/externalTypes";
> schemaLocation="ExternalTypes.xsd"/>
>   <xs:element name="Person">
>   <xs:element name="myAttribute" type="xo:MyAttributeType">
> </xs:schema>
> 
> In castorbuilder.properties:
> # XML namespace mapping to Java packages
> #
> org.exolab.castor.builder.nspackages=\
>   http://schemas/test/externalTypes=com.myStuff.myTypes
> 
> Then just run the generator against MySchema.xsd... I don't know if this is
> a non-standard approach, but it has worked just great for me -
> 
> Hope this helps -
> Margaret
> 
> -----Original Message-----
> From: Andi Kuhn [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 06, 2002 10:25 AM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] SourceGenerator using existing Class as type
> 
> Hi,
> 
> i have a problem using the SourceGenerator with alreasy existing types.
> I want to create a class e.g. Person that uses some other existing class as
> attribute and not just a primitive string or integer.
> 
> public class Person
> {
>     private com.mycompany.MyExistingClass myAttribute;
> 
>     public void setMyAttribute( com.mycompany.MyExistingClass att )
>     {
>          myAttribute = att;
>      }
>     public com.mycompany.MyExistingClass getMyAttribute()
>     {
>          return myAttribute;
>     }
> }
> 
> If i'd use primitve string instead of MyExisingClass schema would be
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; >
>   <xs:element name="Person">
>     <xs:complexType>
>             <xs:sequence>
>               <xs:element name="myAttribute" type="xs:string"/>
>               </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> 
> I tried something like
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; >
>   <xs:element name="Person">
>     <xs:complexType>
>             <xs:sequence>
>               <xs:element name="myAttribute">
>                  <xs:complexType/>
>               </xs:element>
>               </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> 
> Which already is near what i want, but creates a class MyAttribute, that i
> don't want.
> What do i have to do to tell the generator that the type should be my
> existing class and also not creating this class ?
> 
> Thanks for help,
> Andi
> --
> Andreas Kuhn                          Syngenio AG
> Tel: +49 711 4903-490                 Badstr. 9
> Fax: +49 711 4903-500                 70372 Stuttgart
> mailto:[EMAIL PROTECTED]       http://www.syngenio.de
> 
> The answer to 'can emacs...?' is always 'yes'
> 
> -----------------------------------------------------------
> 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

Reply via email to