[relaxng-user] E "oneOrMore" contains "group" contains "attribute" again...

jcowan at reutershealth.com jcowan at reutershealth.com
Tue May 4 11:46:06 ICT 2004


Hutchison, Ben scripsit:

> Bob Foster's suggested fix to my original schema is shown below. Note that
> the NamedElementAttributes are specified for ConfigGroups. I also require a
> name attribute to be present for all elements in the ConfigValue group as
> well, but when I include this it becomes an illegal grammar. At the same
> time, I don't want a top-level blanket requirement of a name attribute for
> every element in the grammar, because eg array elements are not named.

Ah, the light dawns at last.  Are you under the impression that
"(PrimitiveValue | Map | Array), NamedElementAttributes" means that
each of the elements matching the parenthesized pattern must have
the NamedElementAttributes?  Because that's not what you have specified.

The expression instead means "the (partial) content model consisting
of a child element matching PrimitiveValue or Map or Array, plus some
attributes matching NamedElementAttributes".  So when you use it
(via ConfigGroupEntry) in the content model of the ConfigGroup element,
you are specifying the attributes of a ConfigGroup element, not of its
children.  And you are specifying the attributes repeatedly (which is
what is not allowed) via the * on the reference to ConfigGroupEntry,
not to mention that they are already redundantly specified directly in
ConfigGroup's content model.

You must specify, for each element pattern, whether NamedElementAttributes
appears in its content model or not.

-- 
"By Elbereth and Luthien the Fair, you shall    jcowan at reutershealth.com
have neither the Ring nor me!"  --Frodo         http://www.ccil.org/~cowan


More information about the relaxng-user mailing list