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

Re: new to schema: Unique Particle Attribution

From: Burak Emir <Burak.Emir@epfl.ch>
Date: Wed, 06 Apr 2005 10:39:08 +0200
Message-ID: <4253A02C.2000002@epfl.ch>
To: Kostas Karadamoglou <karadamoglou_k@yahoo.gr>
CC: xmlschema-dev@w3.org
Re: new to schema: Unique Particle Attribution

Kostas Karadamoglou wrote:

> question can have either:
>
> title(optional), content and weight
>
> or:
>
> title, content(optional), weight(optional) and question
>
> I tried to implement the above rules in an xml schema but I got a 
> "Unique Particle Attribution". Below I provide you with the xml 
> fragment that implement the rules. Can you tell me how I can implement 
> these rules?

You cannot do this. Put yourself in the place of a guy (the validator) 
that sees only one element at a time.

Abbreviated, your content model starts with something like (a? b) | (a b?)

Now after seeing an 'a' (i.e. title), how does this guy decide whether 
he allows to omission of the 'b'?

There is more than one way to go through the content model (the regular 
expression), which violates the UPA.

It does not look like you can factor this out in the way you want. My 
proposal is to make an abstract 'question', and two concrete 'questionA' 
and 'questionB' that are in the substitution group of 'question'. Or, 
use (questionA | questionB) wherever you used question.

The other possibility is to reorder this into

(title?, content, weight)
|
(question, title, content?, weight?)

See, now there is never any ambuiguity about the branch you are in, so 
you have UPA.

cheers,
Burak

-- 
Burak Emir

http://lamp.epfl.ch/~buraq
Received on Wednesday, 6 April 2005 08:39:12 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.