Hi Jasmin,

Castor is right since you are trying to instantiate a Model group
Definition (not a Content Model Group). This might come from a bad
naming convention from us:

ModelGroup represents a Model Group Definition (group)
Group represents a Content Model Group (sequence, choice, all)

You just have to replace ModelGroup group = new ModelGroup() with Group
group = new Group()

Hope that helps,

Arnaud

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 15, 2003 11:28 PM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] Creating a sequence ModelGroup
> 
> I am new to Castor and have been trying to use
org.exolab.castor.xml.schema to
> programmatically create an XML Schema.
> 
> I have run into a problem creating a <sequence> model group and just
get a
> <group> when using org.exolab.castor.xml.schema.writer to view the
XML. Here
> is the code I tried for adding one ElementDecl (subEl) to another
(elDec):
> 
> ModelGroup group = new ModelGroup();
> group.setOrder(Order.seq);
> group.addElementDecl(subEl);
> 
> ComplexType comp = new ComplexType(schema);
> comp.addGroup(group);
> elDec.setType(comp);
> 
> Here is the output:
> 
> <schema xmlns="http://www.w3.org/2001/XMLSchema";>
>   <element name="root">
>     <complexType>
>       <group>
>         <element name="sub"/>
>       </group>
>     </complexType>
>   </element>
> </schema>
> 
> I expect there is a simple answer to this, can anyone help?
> 
> Also, is there any documentation about using
org.exolab.castor.xml.schema in
> addition to the API docs?
> 
> Thanks,
> 
> Jasmin
> 
> -----------------------------------------------------------
> 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