Hi Rick and Krishna,
Once again I will remind the bug is from XML Spy and not from Castor.
Taken from the XML Schema specification:
"2 If the <simpleContent> alternative is chosen, the type definition
.resolved. to by the .actual value. of the base [attribute] must be
either a complex type definition whose {content type} is a simple type
definition or, only if the <extension> alternative is also chosen, a
simple type definition;"
I definitely recommend you to check your schemas using XSV or IBM
SchemaQualityChecker.
Arnaud
-> -----Original Message-----
-> From: Krishna Rao [mailto:[EMAIL PROTECTED]]
-> Sent: Thursday, January 03, 2002 8:13 PM
-> To: [EMAIL PROTECTED]
-> Subject: Re: [castor-dev] Source generator error - for Complex Types
->
->
-> Thanks Rick.
->
-> I would like to enforce validation restrictions in the schema (
xs:minLength
-> & xs:maxlength ) . I dont think I can use these with xs:extension.
->
-> This being a valid Schema , Castor should be able to generate the
code for
-> it . Is this a known bug ?
-> Are there any other workarounds ?
->
->
-> -Krishna
->
-> -----Original Message-----
-> From: Wood, Rick [mailto:[EMAIL PROTECTED]]
-> Sent: Thursday, January 03, 2002 1:14 PM
-> To: '[EMAIL PROTECTED]'
-> Cc: '[EMAIL PROTECTED]'
-> Subject: RE: [castor-dev] Source generator error - for Complex Types
->
->
-> Hi Krishna,
->
-> I had the same problem, also using XML Spy. You need to set
xs:restriction
-> to xs:extension in the schema.
->
-> - Rick
->
-> -----Original Message-----
-> From: Krishna Rao [mailto:[EMAIL PROTECTED]]
-> Sent: Thursday, January 03, 2002 12:51 PM
-> To: [EMAIL PROTECTED]
-> Subject: [castor-dev] Source generator error - for Complex Types
->
->
->
->
-> Hi ,
-> Getting my feet wet with creating XML Schemas from scratch and using
Castor
-> to do the binding .
->
-> Here is a valid and well-formed (XMLSPy 4.2) XML schema file
->
-> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-> elementFormDefault="qualified" attributeFormDefault="unqualified">
-> <xs:complexType name="AccountNumberType">
-> <xs:simpleContent>
-> <xs:restriction base="xs:string">
-> <xs:minLength value="0"/>
-> <xs:maxLength value="34"/>
-> <xs:attribute name="id" type="xs:string"
-> use="required"/>
-> </xs:restriction>
-> </xs:simpleContent>
-> </xs:complexType>
-> </xs:schema>
->
->
-> When I attempt to generate code for it I get the following exception
(With
-> both .9.3 & .9.3.9 distributions )
->
->
-> java.lang.IllegalStateException: AccountNumberTypeA complex type
cannot be a
-> res
-> triction of a simpleType.
-> at java.lang.Throwable.<init>(Throwable.java:96)
-> at java.lang.Exception.<init>(Exception.java:44)
-> at
java.lang.RuntimeException.<init>(RuntimeException.java:49)
-> at
-> java.lang.IllegalStateException.<init>(IllegalStateException.java:47)
->
-> at
-> org.exolab.castor.xml.schema.reader.SimpleContentRestrictionUnmarshal
-> ler.<init>(SimpleContentRestrictionUnmarshaller.java:124)
-> at
-> org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.startEl
-> ement(SimpleContentUnmarshaller.java:171)
-> at
-> org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.startElem
-> ent(ComplexTypeUnmarshaller.java:214)
-> at
-> org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(S
-> chemaUnmarshaller.java:334)
-> at
-> org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1110)
->
-> at
-> org.apache.xerces.framework.XMLParser.callStartElement(XMLParser.java
-> :1798)
-> at
-> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumen
-> tScanner.java:1837)
-> at
-> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.disp
-> atch(XMLDocumentScanner.java:1377)
-> at
-> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
-> canner.java:381)
-> at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1129)
-> at
-> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
-> tor.java:388)
-> at
-> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
-> tor.java:441)
-> at
-> org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:6
-> 65)
->
->
-> Any clues ?
->
-> Thanks
-> -Krishna Rao
->
-> -----------------------------------------------------------
-> 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