- From: Christian Romberg <christian.romberg@uni-rostock.de>
- Date: Sat, 14 Jul 2001 13:23:38 +0200
- To: www-xml-schema-comments@w3c.org
Hello,
I would like to model the following in xml schema:
<!ELEMENT p (n,p?)>
<!ELEMENT n #PCDATA>
...
Two possibilities are obvious:
<element name="p" type="p_type"/>
<complexType name="p_type">
<sequence>
<element name="n" type="string"/>
<element minOccurs="0" name="p" type="p_type" />
</sequence>
</complexType>
and
<element name="p">
<complexType>
<sequence>
<element name="n" type="string"/>
<element minOccurs="0" ref="p"/>
</sequence>
</complexType>
</element>
In my opinion, at least one of them should be permitted by xml schema
because
otherwise xml schema would be a restriction of DTD regarding this aspect.
But after reading the xml schema specification, it seems both are not
permitted due to:
"3.8.6 Constraints on Model Group Schema Components
All model groups (see Model Groups (§3.8)) must satisfy the following
constraints.
Schema Component Constraint: Model Group Correct
All of the following must be true:
...
2 Circular groups are disallowed. That is, within the {particles} of a group
there may not be at any depth a particle whose {term} is the group itself."
In both cases the <sequence> corresponds to a particle(#1) that contains a
model group(#2):
first case:
#2 contains two particles, one for the n-element (#3) and the other one for
the p-element (#4),
#4's {term} is an "Element Declaration Schema Component" (#5)
#5's {type definition} is the type definition corresponding to the contained
<complexType> (#6)
#6's type definition is besides other properties the {content type}
property, that contains in our case
the value "element-only" and a particle (#7) that is the same as #1.
So #2 contains itself at a certain depth.
second case:
nearly like the first case, except that #4's {term} has to be resolved due
to the presence of the "ref".
This is a global element declaration that corresponds to an "Element
Declaration Schema Component" (#5)
Besides that the argumentation is the same.
So the quoted restriction is applicable with the result, that both attempts
to model the given part of a DTD
are not permitted.
My question is:
Is this correct, or did I oversee something?
In case my argumentation was correct, is this the intention to not allow
such constructions?
In case I made a mistake, what production is correct and more importantly,
why?
Thanks in advance!
Yours sincerely
Christian Romberg
Received on Saturday, 14 July 2001 07:23:22 UTC