- From: Ted Toth <ted.toth@vincera.com>
- Date: Mon, 7 Oct 2002 10:34:56 -0500
- To: <xmlschema-dev@w3.org>
I trying to use Castor to process some XSDs but I'm having a problem and am trying to figure out whether it's the Castor implementation or the XSD that is at fault. I've made the assumption that this a valid schema but maybe it's not. This xsd : <?xml version="1.0" encoding="UTF-8"?> <xsd:schema elementFormDefault="qualified" xmlns:vcml="http://www.vcml.net/1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="element"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="desc"/> <xsd:attribute name="valueDesc" type="xsd:string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="ID"> <xsd:simpleContent> <xsd:restriction base="element"> <xsd:pattern value="[A-Z\d]*"/> </xsd:restriction> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="D_I01"> <xsd:simpleContent> <xsd:restriction base="ID"> <xsd:minLength value="2"/> <xsd:maxLength value="2"/> <xsd:enumeration value="00" vcml:desc="No Authorization Information Present (No Meaningful Information in I02)"/> <xsd:enumeration value="01" vcml:desc="UCS Communications ID"/> <xsd:enumeration value="02" vcml:desc="EDX Communications ID"/> <xsd:enumeration value="03" vcml:desc="Additional Data Identification"/> <xsd:enumeration value="04" vcml:desc="Rail Communications ID"/> <xsd:enumeration value="05" vcml:desc="Department of Defense (DoD) Communication Identifier"/> <xsd:enumeration value="06" vcml:desc="United States Federal Government Communication Identifier"/> <xsd:enumeration value="07" vcml:desc="United States Federal Government Communication Identifier"/> <xsd:attribute fixed="Authorization Information Qualifier" name="desc"/> </xsd:restriction> </xsd:simpleContent> </xsd:complexType> </xsd:schema> which when processed by the IBM XML Schema Quality Checker give no errors gets the following exception: element: 6 ID ID: 21 D_I01 java.lang.IllegalStateException: D_I01 A complex type cannot be a restriction of a simpleType ID at org.exolab.castor.xml.schema.reader.SimpleContentRestrictionUnmarshaller.<init>(SimpleContentRestrictionUnmarshaller.java:141) at org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.startElement(SimpleContentUnmarshaller.java:184) at org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.startElement(ComplexTypeUnmarshaller.java:237) at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUnmarshaller.java:348) at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2ComponentReader.java:253) at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340) at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1197) at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1862) at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1238) at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XM! LDocumentScanner.java:381) at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035) at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:405) at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:458) at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:702) when I try and run it through the source generator. I added some output so I could see what XML type the entities in question were. As you can see 'ID' is being considered a simpleType despite the fact that it is declared a complexType this appears to happen because of the restriction based on 'element' which extends a simpleType. Is this the correct behavior? Can anyone explain this to me please? If this isn't correct then how about a fix? Thanks Ted Toth Vincera Software www.vincera.com 6801 N. Capital of Texas Highway Building 1, Suite 101 Austin, TX 78731 512.233.5517 512.233.5501 fax
Received on Monday, 7 October 2002 11:35:26 UTC