- From: Michael Case <mecase@ucdavis.edu>
- Date: 17 Sep 2003 10:34:41 -0700
- To: Dare Obasanjo <dareo@microsoft.com>
- Cc: XSD <xmlschema-dev@w3.org>
Hi, First, thanks for your answers. [still beating ;-)] On Tue, 2003-09-16 at 17:56, Dare Obasanjo wrote: > > -----Original Message----- > > From: xmlschema-dev-request@w3.org > > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Michael Case > > Sent: Tuesday, September 16, 2003 5:43 PM > > To: XSD > > Subject: RE: allowing zero to unbounded elements in any order? > > > > > > Sorry to beat a dead horse... > > > > XML Schema, therefore, can only be used to define a SUBSET of > > legal XML documents, right? > > Yes. > > > In other words, a file can be a legal XML file and not be > > validatable (if thats a word) by XML Schema. > > No. Any XML file can be validated by an XML Schema. However it is > possible that there are constraints you'd like enforced on the structure > of your document that are not expressible in W3C XML Schema. So, if I have an XML like this <BS> <S/> <S/> <R/> <T/> </BS> and I require 1) two Ss 2) R and T are optional. Those requirements ARE expressible constraints in W3C XML Schema. The constraint 3) "order does not matter" can be expressed in W3C XML Schema along also. But you can not do 1, 2 and 3. You either have 1 and 2 or you have 3. Do people ever validate using two (or N) different schema's in a row? I do not think this will work either unless the whole schema is broken up into little pieces and the XML "documents" are also in "little pieces" otherwise, there would always be SOMETHING that violated one or the other schema. Sincerely, Mike ------------------------ PS ----------- MORE optional reading :-)... In my above example, I made a schema like this (stuff left out. but I think there is enough here to get the idea. I have not looked into the "optimum" Schema that would allow the most variations... This is a first (and maybe only) whack at a solution. Any comments would be appreciated. <xsd:complexType name="BooleanSolidType"> <xsd:annotation> <xsd:documentation> There is no easy way to allow ALL combinations of options for S,S,R,T (two rSolids, one Rotation and one Translation). SSRT TSSR RSST SST STS TSS SS SSTR TSRS RSTS SSR SRS RSS STSR TRSS RTSS STRS Instead we allow: SSTR RTSS TRSS SSRT RSS TSS </xsd:documentation> </xsd:annotation> <xsd:complexContent> <xsd:extension base="SolidType"> <xsd:choice> <xsd:sequence> <xsd:element ref="rSolid" minOccurs="2" maxOccurs="2"/> <xsd:choice minOccurs="0" maxOccurs="1"> <xsd:group ref="rRTOptions"/> </xsd:choice> </xsd:sequence> <xsd:sequence> <xsd:element ref="rRotation" minOccurs="1"/> <xsd:element ref="Translation" minOccurs="0"/> <xsd:element ref="rSolid" minOccurs="2" maxOccurs="2"/> </xsd:sequence> <xsd:sequence> <xsd:element ref="Translation" minOccurs="1"/> <xsd:element ref="rRotation" minOccurs="0"/> <xsd:element ref="rSolid" minOccurs="2" maxOccurs="2"/> </xsd:sequence> </xsd:choice> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:group name="rRTOptions"> <xsd:choice> <xsd:sequence> <xsd:element ref="rRotation" minOccurs="0" maxOccurs="1"/> <xsd:element ref="Translation" minOccurs="0" maxOccurs="1"/> </xsd:sequence> <xsd:sequence> <xsd:element ref="Translation" minOccurs="0" maxOccurs="1"/> <xsd:element ref="rRotation" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:choice> </xsd:group> Mike -- Michael Case Department of Physics University of California, Davis One Shields Avenue Davis, California 95616 case@ucdhep.ucdavis.edu 1.530.754.7226
Received on Wednesday, 17 September 2003 13:34:46 UTC