[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] One problem about XSD
- From: Rick Jelliffe <rjelliffe@allette.com.au>
- To: xml-dev@lists.xml.org
- Date: Fri, 20 Oct 2006 18:00:18 +1000
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]