XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] One problem about XSD

You might try
  <xsd:all>
     <xsd:element name="a">...</xsd:element>
     <xsd:element name="b">...</xsd:element>
     <xsd:element name="c">...</xsd:element>
     <xsd:element name="d">...</xsd:element>
     <xsd:any namespace="##any" processContents="skip" />
 </xsd:all>

If that doesn't work (I presume it doesn't) you could try unfolding it 
to give every
permutation. Or just do something like the following

   <xsd:choice maxOccurs="unbounded">
     <xsd:element name="a">...</xsd:element>
     <xsd:element name="b">...</xsd:element>
     <xsd:element name="c">...</xsd:element>
     <xsd:element name="d">...</xsd:element>
     <xsd:any namespace="##any" processContents="skip" />
 </xsd:choice>

then use a Schematron schema to enforce the single rule

<sch:rule context="whatever">
 <sch:assert test="count(a)=1">There should be one a</sch:assert>
 <sch:assert test="count(b)=1">There should be one b</sch:assert>
 <sch:assert test="count(c)=1">There should be one c</sch:assert>
 <sch:assert test="count(d)=1">There should be one d</sch:assert>
</sch:rule>

Cheers
Rick Jelliffe


Juny Yin wrote:
>
> Hi, xml-dev experts:
>  
>    Now I have one problem about XSD as the following:
> I want to define the contents model of an element, For example the 
> element is <EleParent> and currently it
> has four children elements:<a>,<b>,<c>,<d>. these children elements 
> can appear in any order under  <EleParent>.
> For extensibility any other children elements can be added to 
> <EleParent> in any order. 
>  
> How can I write the schema for this requirement?
> Who can give me the answer?
>  
> Thanks a lot.
>  
> Best regards.
>
>  
>
>
> Juny.Yin
>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS