473,756 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'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 <sequenceamon g 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 <sequenceamon g 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 <restrictionalt ernative 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 1934
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 <sequenceamon g 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
9715
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 separated by the boundary strings, extract headers from each sub-part, etc? Do I need to add something like the following to the beginning? Content-Type: multipart/related; type="multipart/alternative";
0
1779
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 contain multiple occurrences of two possible elements interspersed with regular text.
5
1746
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 structure: <colors> <color>green</color> <color>red</color> </colors>
1
2763
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" minOccurs="0"
3
3037
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 maxOccurs, then the validations passed. I am a little confused about the error message. <?xml version="1.0" encoding="UTF-8"?>
5
7172
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
1679
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: <element> aaaaaaa<foo/>bbbbbb<bar/>cccccc
0
1439
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 in the first. Here's an example of what I'm trying to say: FooList.xsd: ================ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xi="http://www.w3.org/2001/XInclude"
13
8160
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 xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="NAXML-FuelPrice15.xsd"> <pcats:TransmissionHeader>
0
9455
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.