Deepak, I think you have two options for generating subclasses. One is that you create a type available in your xsd for ActionForm and make all of your forms extensions of that type. The other option is to set:
# This property allows one to specify the super class of *all* # generated classes # org.exolab.castor.builder.superclass=ActionForm in the castorbuilder.properties to be the ActionForm class. However, this will cause all classes generated to extend the class you specify. Hope this helps - Margaret -----Original Message----- From: Deepak Pai [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 3:22 PM To: [EMAIL PROTECTED] Subject: [castor-dev] Subclass for castor xml I dont know if this has been answered before - (if it has been please point me towards it :) - thanks) ****************************************************** 1) is it possible to generate Java classes using XSD this way : public class logonform extends ActionForm implements java.io.Serializable { instead of: public class logonform implements java.io.Serializable { I am planning to use STRUTS framework and I need to integrate it with Castor :) *********************************************************** 2. Is it possible to re-use the complex types. Say for RegistrationValueBean1 and RegistrationValueBean2 share addresses; zip code; telephone ; etc...i wish to reuse the generated classes and want to know how to do it :) <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://castor.exolab.org/Test/Invoice"> <xsd:element name="RegistrationValueBean1"> <xsd:complexType> <xsd:sequence> <!-- personal information --> <xsd:element name="firstName" type="xsd:string"/> <xsd:element name="middleInitial" type="xsd:string" minOccurs="0"/> <xsd:element name="lastName" type="xsd:string"/> <xsd:element name="email" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element name="phone" type="TelephoneNumberType"/> <xsd:element name="fax" type="TelephoneNumberType" minOccurs="0"/> <!-- company information --> <xsd:element name="companyName" type="xsd:string"/> <xsd:element name="address1" type="xsd:string"/> <xsd:element name="address2" type="xsd:string" minOccurs="0"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="state" type="stateCodeType"/> <xsd:element ref="zip-code"/> <xsd:element name="country" type="xsd:string"/> <!-- company information details --> <xsd:element name="category" type="categoryCodeType"/> <xsd:element name="subCategory" type="categoryCodeType"/> <xsd:element name="yearFounded" type="yearType" minOccurs="0"/> <xsd:element name="noOfEmployees" type="xsd:string" minOccurs="0"/> <xsd:element name="companyFocus" type="xsd:string" minOccurs="0"/> <xsd:element name="companyClients" type="xsd:string" minOccurs="0"/> <xsd:element name="agree" type="xsd:boolean"/> </xsd:sequence> </xsd:complexType> </xsd:element> <!-- A U.S. Zip Code --> <xsd:element name="zip-code"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{5}(-[0-9]{4})?"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <!-- A Year type --> <xsd:simpleType name="yearType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="([0-9]{4})*"/> </xsd:restriction> </xsd:simpleType> <!-- A category code 0-N --> <xsd:simpleType name="categoryCodeType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]+"/> </xsd:restriction> </xsd:simpleType> <!-- state code types --> <xsd:simpleType name="stateCodeType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Z]{2}"/> </xsd:restriction> </xsd:simpleType> <!-- telephone number types --> <xsd:simpleType name="TelephoneNumberType"> <xsd:restriction base="xsd:string"> <xsd:length value="12"/> <xsd:pattern value="[0-9]{3}-[0-9]{3}-[0-9]{4}"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> ----------------------------------- and RegistrationValueBean2 ---------------------------------- <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://castor.exolab.org/Test/Invoice"> <xsd:element name="RegistrationValueBean2"> <xsd:complexType> <xsd:sequence> <!-- personal information --> <xsd:element name="firstName" type="xsd:string"/> <xsd:element name="middleInitial" type="xsd:string" minOccurs="0"/> <xsd:element name="lastName" type="xsd:string"/> <xsd:element name="email" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element name="phone" type="TelephoneNumberType"/> <xsd:element name="fax" type="TelephoneNumberType" minOccurs="0"/> <!-- company information --> <xsd:element name="companyName" type="xsd:string"/> <xsd:element name="address1" type="xsd:string"/> <xsd:element name="address2" type="xsd:string" minOccurs="0"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="state" type="stateCodeType"/> <xsd:element ref="zip-code"/> <xsd:element name="country" type="xsd:string"/> <!-- company information details --> <xsd:element name="category" type="categoryCodeType"/> <xsd:element name="subCategory" type="categoryCodeType"/> <xsd:element name="yearFounded" type="yearType" minOccurs="0"/> <xsd:element name="noOfEmployees" type="xsd:string" minOccurs="0"/> <xsd:element name="companyFocus" type="xsd:string" minOccurs="0"/> <xsd:element name="companyClients" type="xsd:string" minOccurs="0"/> <xsd:element name="agree" type="xsd:boolean"/> </xsd:sequence> </xsd:complexType> </xsd:element> <!-- A U.S. Zip Code --> <xsd:element name="zip-code"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{5}(-[0-9]{4})?"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <!-- A Year type --> <xsd:simpleType name="yearType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="([0-9]{4})*"/> </xsd:restriction> </xsd:simpleType> <!-- A category code 0-N --> <xsd:simpleType name="categoryCodeType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]+"/> </xsd:restriction> </xsd:simpleType> <!-- state code types --> <xsd:simpleType name="stateCodeType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Z]{2}"/> </xsd:restriction> </xsd:simpleType> <!-- telephone number types --> <xsd:simpleType name="TelephoneNumberType"> <xsd:restriction base="xsd:string"> <xsd:length value="12"/> <xsd:pattern value="[0-9]{3}-[0-9]{3}-[0-9]{4}"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> Thanks a lot. Deepak ----------------------------------------------------------- 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
