Thanks. It worked
--- Keith Visco <[EMAIL PROTECTED]> wrote:
>
>
> I'm not sure if it'll help, but try removing the
> complexType before
> changing the name:
>
>
> schema.removeComplexType(ct);
> ct.setName("ABC");
> schema.addComplexType(ct);
>
> --Keith
>
>
> JK wrote:
> >
> > Hi,
> >
> > I have a Schema with one ComplexType. The
> ComplexType
> > is created with a name. The code generated is
> correct.
> > Now I call setName again on the complexType and
> when I
> > generate code, the complexType does not have a
> name.
> > What am I doing wrong ?
> >
> > Here is the sample code with the output. Note the
> > difference in the complexType in the output
> >
> > public class CastorTester {
> >
> > public CastorTester() {
> > try {
> > Schema schema = new Schema();
> > ComplexType ct =
> > schema.createComplexType("Complex1");
> > schema.addComplexType(ct);
> > writeSchema(schema);
> > ct.setName("ABC");
> > System.out.println("==");
> > writeSchema(schema);
> >
> > } catch (SchemaException ex) {
> > System.out.println(ex);
> >
> > }
> >
> > }
> >
> > public void writeSchema(Schema s) {
> > try {
> > CharArrayWriter charWriter = new
> > CharArrayWriter();
> > SchemaWriter schWr = new
> > SchemaWriter(charWriter);
> >
> > schWr.write(s);
> > String code = charWriter.toString();
> > System.out.println(code);
> > } catch (Exception ex) {
> > System.out.println(ex);
> >
> > }
> >
> > }
> >
> > public static void main(String[] args) {
> > new CastorTester();
> > }
> >
> > }
> >
> > Output
> > =======
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <schema
> >
>
xmlns="http://www.w3.org/2001/XMLSchema"><complexType
> > name="Complex1"/></schema>
> > ==
> > <?xml version="1.0" encoding="UTF-8"?>
> > <schema
>
xmlns="http://www.w3.org/2001/XMLSchema"><complexType/></schema>
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Search - Find what you�re looking for
> faster
> > http://search.yahoo.com
> >
> >
>
-----------------------------------------------------------
> > 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
>
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev