473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Occurence constraints in XSD

hi all

having designed my schema to use repeating groups of elements, I found
that some applications (eg. Microsoft InfoPath) refused to recognised
that element as a repeating element.

I subsequently found that out of the three possible ways (that I know
of) of declaring repeating elements in xsd, only one of these was
understood:

a) occurence constraint on the child element contained in a sequence
compositor IS recognised as a repeating element.
b) occurence constraint on sequence compositor containing the child
element IS NOT recognised as a repeating element.
c) occurence constraint on group reference where the goup is a
sequence compositor containing the child element IS NOT recognised as
a repeating element.

as can be seen from the following xsd schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="testRepeating">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RepeatingChildren">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="repeatingChild" minOccurs="0"
maxOccurs="10"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RepeatingSequence">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="10">
<xsd:element ref="repeatingChild"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RepeatingGroup" type="repeatingGroupType">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="repeatingChild" type="xsd:string"/>
<xsd:group name="repeatingGroup">
<xsd:sequence>
<xsd:element ref="repeatingChild"/>
</xsd:sequence>
</xsd:group>
<xsd:complexType name="repeatingGroupType">
<xsd:group ref="repeatingGroup" minOccurs="0" maxOccurs="10"/>
</xsd:complexType>
</xsd:schema>
only the "//testRepeating/RepeatingChildren/repeatingChild" XPath in
a document instance based on the above schema was treated by the
application as a repeating element.
ignoring that particular limitation, I would like to know which of the
three models above that allow repeating elements is the most
recommended approach, and why ?
thanks
roland
Jul 20 '05 #1
1 3916
Roland wrote:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="testRepeating">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RepeatingChildren">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="repeatingChild" minOccurs="0"
maxOccurs="10"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RepeatingSequence">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="10">
<xsd:element ref="repeatingChild"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RepeatingGroup" type="repeatingGroupType">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="repeatingChild" type="xsd:string"/>
<xsd:group name="repeatingGroup">
<xsd:sequence>
<xsd:element ref="repeatingChild"/>
</xsd:sequence>
</xsd:group>
<xsd:complexType name="repeatingGroupType">
<xsd:group ref="repeatingGroup" minOccurs="0" maxOccurs="10"/>
</xsd:complexType>
</xsd:schema>
.... ignoring that particular limitation, I would like to know which of the
three models above that allow repeating elements is the most
recommended approach, and why ?


I'd say all three are just different ways to express the same constraint.
Second and third are a bit redundant ones for only defining maxOccurence of a
single element, but I believe all of them are valid though.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tesla | last post by:
Hey guys, I have a string like "lalala: djkahsd : dajkdassd : adasd :" Is there a function to find the position of the "I"th occurence of a character/string? Like lets say I want to find out...
0
by: Armin Wagenknecht | last post by:
Hello, i am modelling a TopicMap, and I have the following problem: I want to use two scopes in the topicmap for one occurence which has to satsify BOTH scopes!! Example: I have the...
4
by: John A Fotheringham | last post by:
I have a table that tracks GPS records broadly speaking as follows ts DATETIME username VARCHAR(16) ... GPS data ... I want to select the most recent GPS data for each distinct user. That...
4
by: Dmitri | last post by:
I just looked at a coworker's stored procedure and this person is dropping 4 Foreign key constraints and then re-adding them after processing the required logic (updating rows in the 4 tables in...
2
by: DW | last post by:
Greetings: I have to do a one-off forceful change of some data in a database. I need to disable some FK constraints, make the data change, and then re-enable the constraints. My process will...
3
by: das | last post by:
Hi all, How can I get a row that has only one occurence in a table? Not through 'distinct' because this gets a single row that might have multiple occurences, I want to get only rows that have...
3
by: utab | last post by:
Dear all, I tried to solve the occurence problem: to find the distinct occurences of a word in an input. I know that I could use map and other STD lib functions. I tried to do it the hard way. I...
2
by: gauravguleria | last post by:
wht's the program which takes two strings using command line arguments and finds the occurence of second string in the first string.The program should return the starting position of first...
1
by: mustafalp | last post by:
i want to write it with following prototype: int occurence (int a,intasize,int e) this function must returns the number of occurence of e in the array a in c++.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.