Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - W3C Schema for required and optional elements >Thread Next - Re: W3C Schema for required and optional elements Re: W3C Schema for required and optional elementsTo: NULL Date: 4/11/2008 11:19:00 AM Philipp <sicsicsic@f...> wrote in <1207843345_2873@s...>: > I'm learning W3C Schema 1.0 and have encountered a > problem. I want to make a complex type which requires to > contain exactly 1 instance of each of a list of elements > (a, b, c) and at least once a choice of several other > elements ( d1 | d2 | d3 ). This in any order. > > I have come up with the following which is (unfortunately) > invalid XSD 1.0: <complexType name="root"> > <all> > <element name="a" type="string"></element> > <element name="b" type="string"></element> > <element name="c" type="string"></element> > <choice maxOccurs="unbounded" minOccurs="1"> > <element name="d1" type="string"></element> > <element name="d2" type="string"></element> > <element name="d3" type="string"></element> > </choice> > </all> > </complexType> W3C's schema definition language was not designed for defining arbitrarily complex grammars. If your document format is well-structured, expressing it in XML Schema should be easy. If it's not, try using a more powerful schema definition language or check validity on the application side. -- "...a Netscape engineer who shan't be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30..." --Blake Ross | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
