- From: Stefan Wachter <Stefan.Wachter@gmx.de>
- Date: Mon, 7 Oct 2002 19:00:26 +0200 (MEST)
- To: Anli Shundi <ashundi@tibco.com>;xmlschema-dev@w3.org
Hi Anli,
I think it IS alright because the base type of the restriction is a complex
type with simple content (and not a simple type). Therefore it is possible to
restrict it.
--Stefan
> It is not alright:
>
> > > <xsd:complexType name="ID">
> > > <xsd:simpleContent>
> > > <xsd:restriction base="element">
> > > <xsd:pattern value="[A-Z\d]*"/>
> > > </xsd:restriction>
> > > </xsd:simpleContent>
> > > </xsd:complexType>
>
> the complexType "ID" should have instead been a simpleType.
>
> http://www.w3.org/TR/xmlschema-1/#src-ct point 2 is fulfilled but
> point 2 of http://www.w3.org/TR/xmlschema-1/#ct-props-correct is not:
>
> 2 If the {base type definition} is a simple type definition, the
> {derivation
> method} must be extension.
>
> Anli Shundi
> TIBCO Software Inc.
> www.tibco.com
>
>
> > -----Original Message-----
> > From: Stefan Wachter [mailto:Stefan.Wachter@gmx.de]
> > Sent: Monday, October 07, 2002 12:48 PM
> > To: Ted Toth; xmlschema-dev@w3.org
> > Subject: Re: A complex type cannot be a restriction of a simpleType ??
> >
> >
> >
> > Hi Ted,
> >
> > your schema seems to be alright. I tried it with "JBind" my
> > own Java-XML
> > data binding framework (available at http://jbind.sourceforge.net).
> >
> > --Stefan
> >
> > The resulting interfaces are:
> >
> > public interface IElementData extends
> > org.jbind.xml.core.data.IStringData,
> > org.jbind.xml.core.data.IComplexSCData {
> > /**
> > * Gets the <a href="#attribute_desc">desc</a> attribute.
> > * @return <i>(required)</i>
> > */
> > java.lang.Object getDesc();
> > /**
> > * Gets the <a
> > href="#attribute_valueDesc">valueDesc</a> attribute.
> > * @return <i>(required)</i>
> > */
> > java.lang.String getValueDesc();
> > }
> >
> > public interface IIDData extends IElementData {
> > }
> >
> > public interface ID_I01Data extends IIDData {
> > static final ID_I01Data _00 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", 00");
> > static final ID_I01Data _01 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "01");
> > static final ID_I01Data _02 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "02");
> > static final ID_I01Data _03 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "03");
> > static final ID_I01Data _04 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "04");
> > static final ID_I01Data _05 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "05");
> > static final ID_I01Data _06 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "06");
> > static final ID_I01Data _07 =
> > (ID_I01Data)org.jbind.xml.schema.cmp.Schemas.getInstance().get
> > EnumerationOption("ID_I01Data", "07");
> > }
> >
> >
> >
> > >
> > > 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.SimpleContentRestrictionUn
> > marshaller.<init>(SimpleContentRestrictionUnmarshaller.java:141)
> > > at
> > >
> > org.exolab.castor.xml.schema.reader.SimpleContentUnmarshaller.
> > startElement(SimpleContentUnmarshaller.java:184) at
> > >
> > org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.st
> > artElement(ComplexTypeUnmarshaller.java:237)
> > > at
> > >
> > org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startEl
> > ement(SchemaUnmarshaller.java:348) at
> > >
> > org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startE
> > lement(Sax2ComponentReader.java:253) at
> > >
> > org.apache.xerces.parsers.SAXParser.startElement(SAXParser.jav
> > a:1340) at
> > >
> > org.apache.xerces.validators.common.XMLValidator.callStartElem
> > ent(XMLValidator.java:1197)
> > > at
> > >
> > org.apache.xerces.framework.XMLDocumentScanner.scanElement(XML
> > DocumentScanner.java:1862) at
> > >
> > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatch
> > er.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(Sourc
> > eGenerator.java:405) at
> > >
> > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc
> > eGenerator.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 13:00:59 UTC