mahesh.kanakaraj
Usenet Archive
- Joined
- Sep 14, 2006
- Messages
- 7
- Reaction score
- 0
Hi All,
I have a confusion in finding the 'effective content' of a complex type definition in a XML Schema.
I shall give you an example situation to clearly explain my problem.
Let's have an element declaration as follows:
<element name = "A" type="A_Type">
which is of type defined by the complexType definition as follows:
<complexType name="A_Type">
<complexContent>
<restriction base="anyType">
<choice>
<element name="One" type="string"/>
<element name="Two" type="string"/>
</choice>
</restriction>
</complexContent>
</complexType>
Now, based on the XML Schema specification [1], finding the effective content for the complex type "A_Type" is what is really confusing me.
The specification says........
<quote>
[...]
2 [Definition:] Let the effective content be the appropriate case among the following:
2.1 If one of the following is true
2.1.1 There is no <group>, <all>, <choice> or <sequence> among the [children];
2.1.2 There is an <all> or <sequence> among the [children] with no [children] of its own excluding <annotation>;
2.1.3 There is a <choice> among the [children] with no [children] of its own excluding <annotation> whose minOccurs [attribute] has the ·actual value· 0; Then the appropriate case among the following:
2.1.4 If the ·effective mixed· is true, then A particle whose properties are as follows:
{min occurs}
1
{max occurs}
1
{term}
A model group whose {compositor} is sequence and whose {particles} is empty.
2.1.5 otherwise empty
2.2 otherwise the particle corresponding to the <all>, <choice>, <group> or <sequence> among the [children]. [...] </quote>
Since for the complex type given above, the conditions 2.1 and 2.2 becomes false, and the condition 2.3 becomes true (since none of the children has 'minoccurs' as '0'), so the calculation of the effective content is done using 2.1.4 or 2.1.5 based on the 'effective mixed' value.
For the complex type declared above 'effective mixed' is false, so
2.1.5 is chosen and the 'effective content' becomes empty.
And as per the specification (quote given below), calculating the 'conent type' of this complex type node...... <quote> [....] 3 Then the value of the property is the appropriate case among the following:
3.1 If the <restriction> alternative is chosen,
then the appropriate case among the following:
3.1.1 If the ·effective content· is empty ,
then empty;
3.1.2 otherwise a pair consisting of
3.1.2.1 mixed - if the ·effective mixed· is true, otherwise elementOnly
3.1.2.2 The ·effective content·.
[....]
</quote>
Since the 'effective content' identified is empty, using 3.1.1, the 'content type' of this complex type becomes empty.
My question comes here..........
Shouldn't the 'content type' of this complex type node be a 'Choice'?
Is my interpretation of the specification
correct? Or where am I going wrong?
Any kind of help would be appreciated.
Thanks in Advance.
Mahesh K U
[1] - "http://www.w3.org/TR/xmlschema-1/#key-efm"
I have a confusion in finding the 'effective content' of a complex type definition in a XML Schema.
I shall give you an example situation to clearly explain my problem.
Let's have an element declaration as follows:
<element name = "A" type="A_Type">
which is of type defined by the complexType definition as follows:
<complexType name="A_Type">
<complexContent>
<restriction base="anyType">
<choice>
<element name="One" type="string"/>
<element name="Two" type="string"/>
</choice>
</restriction>
</complexContent>
</complexType>
Now, based on the XML Schema specification [1], finding the effective content for the complex type "A_Type" is what is really confusing me.
The specification says........
<quote>
[...]
2 [Definition:] Let the effective content be the appropriate case among the following:
2.1 If one of the following is true
2.1.1 There is no <group>, <all>, <choice> or <sequence> among the [children];
2.1.2 There is an <all> or <sequence> among the [children] with no [children] of its own excluding <annotation>;
2.1.3 There is a <choice> among the [children] with no [children] of its own excluding <annotation> whose minOccurs [attribute] has the ·actual value· 0; Then the appropriate case among the following:
2.1.4 If the ·effective mixed· is true, then A particle whose properties are as follows:
{min occurs}
1
{max occurs}
1
{term}
A model group whose {compositor} is sequence and whose {particles} is empty.
2.1.5 otherwise empty
2.2 otherwise the particle corresponding to the <all>, <choice>, <group> or <sequence> among the [children]. [...] </quote>
Since for the complex type given above, the conditions 2.1 and 2.2 becomes false, and the condition 2.3 becomes true (since none of the children has 'minoccurs' as '0'), so the calculation of the effective content is done using 2.1.4 or 2.1.5 based on the 'effective mixed' value.
For the complex type declared above 'effective mixed' is false, so
2.1.5 is chosen and the 'effective content' becomes empty.
And as per the specification (quote given below), calculating the 'conent type' of this complex type node...... <quote> [....] 3 Then the value of the property is the appropriate case among the following:
3.1 If the <restriction> alternative is chosen,
then the appropriate case among the following:
3.1.1 If the ·effective content· is empty ,
then empty;
3.1.2 otherwise a pair consisting of
3.1.2.1 mixed - if the ·effective mixed· is true, otherwise elementOnly
3.1.2.2 The ·effective content·.
[....]
</quote>
Since the 'effective content' identified is empty, using 3.1.1, the 'content type' of this complex type becomes empty.
My question comes here..........
Shouldn't the 'content type' of this complex type node be a 'Choice'?
Is my interpretation of the specification
correct? Or where am I going wrong?
Any kind of help would be appreciated.
Thanks in Advance.
Mahesh K U
[1] - "http://www.w3.org/TR/xmlschema-1/#key-efm"