- From: Anli Shundi <ashundi@tibco.com>
- Date: Fri, 18 Apr 2003 13:58:46 -0400
- To: "'Navid'" <silencer2020@yahoo.ca>, Mohan Raj <mohanrajd@hotmail.com>, xmlschema-dev@w3.org
something simpler like seems sufficient
(f1*|f2*|f3*)*
<schema
xmlns:tns="tns"
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="tns"
elementFormDefault="qualified" >
<element name="record">
<complexType>
<choice maxOccurs="unbounded">
<element name="field1" type="tns:type" maxOccurs="unbounded"
/>
<element name="field2" type="tns:type" maxOccurs="unbounded"
/>
<element name="field3" type="tns:type" maxOccurs="unbounded"
/>
</choice>
</complexType>
</element>
<complexType name="type">
<sequence>
<element name="value" type="string"/>
</sequence>
</complexType>
</schema>
Anli Shundi
TIBCO Software Inc.
www.tibco.com
> -----Original Message-----
> From: Navid [mailto:silencer2020@yahoo.ca]
> Sent: Friday, April 18, 2003 1:16 PM
> To: Mohan Raj; xmlschema-dev@w3.org
> Subject: Re: XML Schema: Alternating "unbounded" elements
>
>
>
> > <field1>
> > <value>x
> > </value>
> > </field1>
> >
> > <field3>
> > <value>x
> > </value>
> > </field3>
>
> This should do it:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.example.com"
> elementFormDefault="qualified"
> xmlns:target="http://www.example.com">
>
> <element name="field1" type="target:myType"/>
> <element name="field2" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field3" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field4" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field5" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field6" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field7" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field8" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field9" type="target:myType"
> substitutionGroup="target:field1"/>
> <element name="field10" type="target:myType"
> substitutionGroup="target:field1"/>
>
> <element name="record">
> <complexType>
> <sequence>
> <element ref="target:field1"
> minOccurs="0"
> maxOccurs="unbounded"/>
> </sequence>
> </complexType>
> </element>
>
> <complexType name="myType">
> <sequence>
> <element name="value" type="string"/>
> </sequence>
> </complexType>
> </schema>
>
>
> Navid.
>
>
> --- Mohan Raj <mohanrajd@hotmail.com> wrote: >
> >
> > I am fairly new to XML and i searched through the
> > archives but did not find
> > any solution for this issue.
> >
> > I am trying to define a schema that can validate the
> > following XML document.
> >
> > <record>
> > <field1>
> > <value>x
> > </value>
> > </field1>
> >
> > <field2>
> > <value>x
> > </value>
> > </field2>
> >
> > <field1>
> > <value>x
> > </value>
> > </field1>
> >
> > <field3>
> > <value>x
> > </value>
> > </field3>
> >
> > <field2>
> > <value>x
> > </value>
> > </field2>
> >
> > ...
> >
> > </record>
> >
> > i have a bunch of fields field1 through field10 and
> > i can have multiple
> > occurences of every field (maxOccurs = "unbounded")
> > and they need not be in
> > a sequence (i.e.
> > field1 occuring thrice followed by field2 occuring
> > twice etc). these
> > elements can alternate as shown above (in any
> > order).
> >
> > please provide a sample schema that can do something
> > like this. i appreciate
> > your help.
> >
> > thanks
> > mohan
> >
> >
> >
> _________________________________________________________________
> > Help STOP SPAM with the new MSN 8 and get 2 months
> > FREE*
> > http://join.msn.com/?page=features/junkmail
> >
>
> ______________________________________________________________
> ________
> Post your free ad now! http://personals.yahoo.ca
>
>
Received on Friday, 18 April 2003 14:05:52 UTC