- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 10 Jan 2001 08:53:12 +0000
- To: Badt <estee@isdn.net.il>
- Cc: xmlschema-dev@w3.org
Badt <estee@isdn.net.il> writes: > Meening a model of an element, which has a few sons that must appear and any > other sons, eg: > <car> > <type>....</type> > <price>...</price> > <detail1>...</detail1> > <detail2>...</detail2> > <detail3>...</detail3> > <detail4>...</detail4> > </car> > > I would like a schema that would validate that the car contains a price and > a type but permites anything else > is there any way? > > I've of something like: > > <xsd:all> > <xsd:element name='type'/> > <xsd:element name='price'/> > <xsd:any/> > </xsd:all> > > or a similar model > it doesnt work of course and i willl be glad if any one with a better idea > would help That model will work if you change it to a sequence, so you have two alternatives as things stand: <xs:sequence> <xs:element name='type'/> <xs:element name='price'/> <xs:all minOccurs='0' maxOccurs='unbounded'/> <xs:sequence/> <xs:choice minOccurs='0' maxOccurs='unbounded'/> <xs:element name='type'/> <xs:element name='price'/> <xs:all namespace='##other'/> </xs:choice> The first allows your elements all to share a namespace, but requires fixed order. The second allows any ordering, doesn't require the <type> and <price> elements, and requires the extra elements to be in a separate namespace. ht -- 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/
Received on Wednesday, 10 January 2001 03:53:16 UTC