Query on elementFormDefault & Restrictions (using AltovaXmlSpy)

D

dickster

I have a query surrounding about elementFormDefault

I have abbreviated the schemas - and hopefully have included all the
relevant information

I get the following error message (AltovaXmlSpy-when I click validate)
in Schema1.xsd:
"The content model of complex type '{no name}' is not a valid
restriction of the content model of complex type 'origo:TimePeriod'"

What does this mean? - when I switch elementFormDefault to "qualified"
I DONT GET ANY ERROR MESSAGE :-|

---------------------------------------------------------------------------------------
Schema1.xsd
---------------------------------------------------------------------------------------
<xsd:schema
xmlns:eek:rigo="http://www.origoservices.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.origoservices.com"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">

<xsd:include schemaLocation="Schema2.xsd"/>

<xsd:complexType name="product">
<xsd:sequence>
 
M

Martin Honnen

dickster said:
I have a query surrounding about elementFormDefault
I get the following error message (AltovaXmlSpy-when I click validate)
in Schema1.xsd:
"The content model of complex type '{no name}' is not a valid
restriction of the content model of complex type 'origo:TimePeriod'"

What does this mean? - when I switch elementFormDefault to "qualified"
I DONT GET ANY ERROR MESSAGE :-|

You might want to use that then, if you want to define elements in a
namespace then using elementFormDefault="qualified" is usually what you
want and need to easily and consistently define your elements in the
target namespace specified.


<xsd:schema
xmlns:eek:rigo="http://www.origoservices.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.origoservices.com"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">

<xsd:element name="start_date" type="origo:Date"/>

If you use elementFormDefault="unqualified" then I think you need
<xsd:element name="origo:start_date"
to fit the definitions in the other included schema.
 
H

Henry S. Thompson

dickster said:
I have a query surrounding about elementFormDefault

I have abbreviated the schemas - and hopefully have included all the
relevant information

I get the following error message (AltovaXmlSpy-when I click validate)
in Schema1.xsd:
"The content model of complex type '{no name}' is not a valid
restriction of the content model of complex type 'origo:TimePeriod'"

The base complex type includes an element declaration which accepts
EIIs whose expanded name is {http://www.origoservices.com, start_date}

Your restriction attempts to restrict that with an element declaration
which accepts EIIs whose expanded name is {[none],start_date}.

The difference arises because only elementFormDefault is 'qualified'
in the base schema document and 'unqualified' in yours, and that's
what determines whether element declarations within complex type
definitions acquire the target namespace of the enclosing schema
document.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
D

dickster

Thanks for your reply Martin.

When I keep the elementFormDefault attribute consistent between each
Schema it works fine.

dickster
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top