- From: Priscilla Walmsley <priscilla@walmsley.com>
- Date: Thu, 18 Apr 2002 16:57:32 -0400
- To: "'Randy Eastwood'" <sunmesa@cox.net>, W3C XSchema List <xmlschema-dev@w3.org>
Hi Randy, You need a choice group with minOccurs="0" and maxOccurs="unbounded". It would look like: <xs:element name="A"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="B" type="xs:string"/> <xs:element name="C" type="xs:string"/> <xs:element name="D" type="xs:string"/> <xs:element name="E" type="xs:string"/> <xs:element name="F" type="xs:string"/> </xs:choice> </xs:complexType> </xs:element> Hope that helps! Priscilla ----------------------------------------------------------------------------- Priscilla Walmsley priscilla@walmsley.com Author, Definitive XML Schema (Prentice Hall PTR) ----------------------------------------------------------------------------- -----Original Message----- From: Randy Eastwood [SMTP:sunmesa@cox.net] Sent: Thursday, April 18, 2002 4:35 PM To: W3C XSchema List Subject: Usage of compositors and groups Hi folks, I've been reading two references on schema. The W3C recommendation and a Wrox book titled Professional XSchema. I am trying to answer what seems to me to be a basic simple question. I need to construct an element A as an anonymous complexType with element only content. There are 5 elements (B,C,D,E, and F) to be included in the complex type for element A. Elements B thru F do not need to be in sequence, do not have to occurr at all, and are unbounded in occurrence limit. What combination of compositors (all | sequence | choice | group) and/or constraints (minOccur and maxOccur) does the trick? Here's the template minus all the compositors and/or constraints: <xs:element name="A"> <xs:complexType> <xs:element name="B" type="xs:string"/> <xs:element name="C" type="xs:string"/> <xs:element name="D" type="xs:string"/> <xs:element name="E" type="xs:string"/> <xs:element name="F" type="xs:string"/> </xs:complexType> </xs:element> /r Randy Quote from Ellen Ullman's book, "Close to the Machine": "Human thinking can skip over a great deal, leap over small misunderstandings, can contain ifs and buts in untroubled corners of the mind. But the machine has no corners. Despite all the attempts to see the computer as a brain, the machine has no foreground or background. It can be programmed to behave as if it were working with uncertainty, but -- underneath, at the code, at the circuits -- it cannot simultaneously do something and withhold for later something that remains unknown. In the painstaking working out of the specification, line by code line, the programmer confronts an awful, inevitable truth: The ways of human and machine understanding are disjunct."
Received on Thursday, 18 April 2002 16:56:32 UTC