- From: Mark Feblowitz <mfeblowitz@frictionless.com>
- Date: Mon, 17 Jun 2002 17:31:11 -0400
- To: "'Calvin Smith'" <calvins@SIMS.Berkeley.EDU>
- Cc: "Xmlschema-Dev (E-mail)" <xmlschema-dev@w3.org>
Ah, yes. Different validation for text mode versus schema view mode. And I hadn't thought it through. This seems to work: <xs:simpleType name="MySimpleType"> <xs:restriction base="xs:string"> <xs:enumeration value="a possible value"/> <xs:enumeration value="another possible value"/> </xs:restriction> </xs:simpleType> <xs:complexType name="ExampleType"> <xs:simpleContent> <xs:extension base="" base="MySimpleType"> <xs:attribute name="anAttribute" type="xs:token"/> </xs:extension> </xs:simpleContent> </xs:complexType> It also separates out the extension from the restriction, which you can't do in the same derivation step, anyway (where the implied "extension" comes when you add the attributes and the restriction comes when you restrict the simpleType). Next time I'll fully engage my brain. Any further mistakes, Schema gurus? Mark Mark Feblowitz XML Architect [t] 617.715.7231 [f] 617.495.0188 Frictionless Commerce Incorporated [e] mfeblowitz@frictionless.com [w] http://www.frictionless.com [m] 400 Technology Square, 9th Floor Cambridge, MA 02139 Open Applications Group Incorporated [e] mfeblowitz@openapplications.org [w] http://www.openapplications.org -----Original Message----- From: Calvin Smith [mailto:calvins@SIMS.Berkeley.EDU] Sent: Monday, June 17, 2002 4:20 PM To: Mark Feblowitz Subject: RE: restricting anySimpleType in complexType definition Hi Mark, On Mon, 17 Jun 2002, Mark Feblowitz wrote: > On our schema, you're better off with > <xsd:complexType name="ExampleType"> > <xsd:simpleContent> > <xsd:restriction base="xsd:string"> > <xsd:enumeration value="a possible value"/> > <xsd:enumeration value="another possible value"/> > <xsd:attribute name="anAttribute" type="xsd:token"/> > </xsd:restriction> > </xsd:simpleContent> > </xsd:complexType> > > unless your enumerations are going to be other than strings. > > It's good that you asked, and that you're concerned. We found in our > development that we had to check our schemas with all parsers that we > intended to use. Even then, there's no guarantee that a schema that works > today will work tomorrow, although they are growing more complete all the > time. > > You should consider getting another parser to check your schema. Consider, > e.g., Xerces, MSXML 4, which are production parsers, or SQC (the Schema > Quality Checker) or XSV (XML Schema Validator), which are development-time > checkers. Thanks for your help. I initially tried your suggestion, but Xml Spy complains, saying that I must "use a complexType instead of xsd:string, because a simpleContent/restriction can't be based on a simpleType." That was how I ended up with the anySimpleType. Anyway, thanks again. I am downloading SQC now to see what it says, but I guess it isn't legal, according to the previous discussion, even if XML Spy allows it. -calvin
Received on Monday, 17 June 2002 17:31:43 UTC