[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Limiting element occurance by attribute values

From: Randy J. Ray <randy.j.ray@gmail.com>
Date: Thu, 23 Dec 2004 16:29:53 -0800
Message-ID: <35cda21d041223162971b6aa21@mail.gmail.com>
To: xmlschema-dev@w3.org
xsd element occurance

I'm pretty sure that the answer to this lay somewhere in the use of
the <unique> and/or <key> elements. However, I am just not too clear
on how.

Here's the situation: I am working on a schema definition for software
changelogs, those loosely-formatted documents we all love from
open-source projects. As part of the schema, I have declared an
element <description>, that like schema's <documentation> can appear
at most scope-levels.

Now, here's where I'm stuck: I want <description> to be limited to one
occurrance at a given scope, but I want to allow multiples
if-and-only-if the value of an attribute called "language" is
different. (The attribute is declared with "en-US" as a default, so
the only requirement for a second and subsequent <description> block
is language="something-else".)

Were it just a matter of limiting the tag to one occurrance, that is
trivial. And I *think* I understand how to use <unique> to accomplish
this, but I'm not sure. I'd rather get some (semi-)expert advice. And
if I use <unique>, do I put it in the <complexType> that defines
<description> (which I cleverly call "descriptionType"), or do I put
it in the places where the tag <description> is actually declared as
an instance of descriptionType?

All feedback greatly appreciated.

Randy
-- 
Randy J. Ray / randy.j.ray@gmail.com
Campbell, CA
Received on Friday, 24 December 2004 02:43:15 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.