473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

'Effective Content' of a ComplexType in a Schema

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>, <choiceor <sequence>
among the [children];
2.1.2 There is an <allor <sequenceamong the [children]
with no [children] of its own excluding
<annotation>;
2.1.3 There is a <choiceamong 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>,
<groupor <sequenceamong 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 <restrictionalternative 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"

Jun 19 '07 #1
1 1906
On 19 Jun, 08:34, mahesh.kanaka...@gmail.com wrote:
....
<complexType name="A_Type">
<complexContent>
<restriction base="anyType">
<choice>
<element name="One" type="string"/>
<element name="Two" type="string"/>
</choice>
</restriction>
</complexContent>
</complexType>
....
2.1.3 There is a <choiceamong 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
....
2.1.5 otherwise empty
2.2 otherwise the particle corresponding to the <all>, <choice>,
<groupor <sequenceamong the [children].
[...]
</quote>
XML schema is an appallingly written spec. If I were you I would try
and make do with the primer, or a book such as Eric van der Vlist's.

In the case you mention, I think it's ambiguous in 2.1.3 as to what
the "whose" refers to. (In fact the spec if rife with these
ambiguities, often forcing you to work out what "it's" might refer to
from a number of possibilities!)

Clearly the construct you refer to is not empty. Therefore, the only
way to interpret 2.1.3 is to infer that the "whose" is referring to
the choice element. e.g. it would be better written as:

2.1.3 There is a <choiceamong the [children] whose minOccurs
[attribute] has the ·actual value· 0 and has no [children] of its own
excluding <annotation>.

Then the case you specify invokes 2.1.5 and 3.1.2.2.

The implication is that:

<choice minOccurs="0"></choiceis legal, but
<choice></choiceis illegal.

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================

Jun 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dave Kuhlman | last post by:
Suppose that I have content that looks like what I've included at the end of this message. Is there something in the standard Python library that will help me parse it, break into the parts...
0
by: Swaroop Kumar | last post by:
Hi: I'm trying to write a schema that contains information as described below: 1. The first element is a mandatory fixed string. 2. The second element is a mixed content element that can...
5
by: mhuhn.de | last post by:
I am using XML Schema for quite a while but haven't written a single line of Relax NG yet. For what I know, I cannot define static content within an XML Schema. For example, I have the following...
1
by: Mike Kayser | last post by:
Hi, I have a schema which is fine except for one part giving me trouble: (...) <xs:element name="DOC"> <xs:complexType mixed="true"> <xs:sequence> <xs:any processContents="lax"...
3
by: jacksuyu | last post by:
In XMLSpy, I got error message in my xsd: This schema doesn't appear to be valid by itself:<xs:element ref='MyConfig'> makes the content model non-deterministic. If I remove the minOccurs and...
5
by: Damiano ALBANI | last post by:
Hello, I'd like to write a single XML Schema for both these documents : <Items> <Item xml:id="id1"> <Name>ABC</Name> ... </Item> <Item xml:id="id2">
6
by: Lord0 | last post by:
Hi there, How do I define in a schema that an element (<element>) may have any content i.e. text, other elements, partial elements, angle brackets etc? So all of the following would be valid:...
0
by: daldridge | last post by:
I don't know if what I want to do is possible or not, but I'd like to have an xs:key in my schema that constrains attributes directly in a document, as well as those in another document, included...
13
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.