- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 10 Jan 2002 09:54:46 +0000
- To: Eddie Robertsson <eddie@allette.com.au>
- Cc: boriero <aboriero@hoc.elet.polimi.it>, XSD <xmlschema-dev@w3.org>
- Message-ID: <f5by9j64jkp.fsf@cogsci.ed.ac.uk>
Eddie Robertsson <eddie@allette.com.au> writes: > boriero wrote: > > > Can I create a new complexType with a simpleContent by > > restricting or extending a basetype which is itself derived by > > restriction or extension ? <snip/> I don't disagree with any of Eddie's comments on what is and isn't correct in boriero's first set of examples, but wrt > As I read the spec this [type named '3'] should also be valid > although none of the validators I tested with could validate this > type correctly. I demur -- XSV is happy with the attached, which is 1, 2 and 3 with minor typos and the 'mixed' bug fixed. > > 2. when i create a new complexType with a complexContent , can > > i restrict a base type removing one or more child elements? > > <xs:complexType name="..."> > > <xs:simpleContent> > > <xs:restriction base="..." > > > <xs:simpleType name="..."> > > This is not valid as you have written it. The reason being that you > can't declare a named simpleType that isn't a direct child of the > xs:schema element. Written like this: > > <xs:complexType name="..."> > <xs:simpleContent> > <xs:restriction base="..." > > <xs:simpleType> > <xs:restriction base="xs:integer"/> > > It could be used to restrict the text content of a previously defined > complexType. However, there is a contradiction in the spec regarding > this issue, see Henry's mail earlier [2]. That contradiction only arises if you're trying to restrict a complex type definition with complex content. If the complex type definition has _simple_ content, then there's no doubt you're OK, so e.g. given boriero's original example, corrected slightly, we can have: <xs:complexType name="t1"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="x" type="xs:integer"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="t4"> <xs:simpleContent> <xs:restriction base="t1" > <xs:simpleType> <xs:restriction base="xs:token"> <xs:pattern value=".*a.*"/> </xs:restriction> </xs:simpleType> </xs:restriction> </xs:simpleContent> </xs:complexType> ht > [1] http://www.w3.org/TR/xmlschema-1/#declare-type (in the table with > heading: Complex Type Definition with simple content Schema Component) > > [2] http://lists.w3.org/Archives/Public/xmlschema-dev/2002Jan/0063.html
-- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Attachments
- application/xml attachment: example schema
Received on Thursday, 10 January 2002 04:54:51 UTC