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 UTC