W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Re: schema <include>

From: <Stefan.Wachter@gmx.de>
Date: Thu, 20 Feb 2003 11:02:46 +0100 (MET)
To: rainerbecker.mail@t-online.de (Rainer Becker)
Cc: xmlschema-dev@w3.org
Message-ID: <22486.1045735366@www28.gmx.net>

Hi Rainer,

your instance document is incorrect because the <Name> element is declared
to be unqualified. Yet, in your instance document you declare a default
namespace that is also applied on the <Name> element. Therefore the <Name> element
is qualified in your instance document which is in conflict to the
declaration of the <Name> element.

To my knowledge the elementFormDefault of an included schema is NOT
overwritten by the elementFormDefault of the including schema.

--Stefan

> 
> Hallo newsgroup readers,
> 
> This question is about <include>ing schemas.
> This are the documents.
> 
> Instance
> ########
> 
> <Firma xmlns="http://www.rbecker.de/test/include">
>    <Person>
>       <Name>Meier</Name>
>    </Person>
> </Firma>
> 
> A.xsd
> #####
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     targetNamespace="http://www.rbecker.de/test/include"
>     xmlns:pref="http://www.rbecker.de/test/include"
>     elementFormDefault="qualified">
> 
>    <xs:include schemaLocation="B.xsd" />
> 
>    <xs:element name="Firma">
>       <xs:complexType>
>          <xs:sequence>
>             <xs:element ref="pref:Person" />
>          </xs:sequence>
>       </xs:complexType>
>    </xs:element>
> </xs:schema>
> 
> B.xsd
> #####
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>      elementFormDefault="unqualified">
> 
>    <xs:element name="Person">
>       <xs:complexType>
>          <xs:sequence>
>             <xs:element name="Name" type="xs:string" />
>          </xs:sequence>
>       </xs:complexType>
>    </xs:element>
> 
> </xs:schema>
> 
> It is perfectly valid, that A.xsd (with targetNamespace) includes
> B.xsd (without targetNamespace).
> 
> Nevertheless the instance document above is invalid. It
> wasn´t, if you substituted the following line:
> 
> <Name>Meier</Name>
> 
> with
> 
> <Name xmlns="">Meier</Name>
> 
> Question:
> 
> Because B.xsd has no namespace, it inherits the targetNamespace
> >from A.xsd. Do I understand it correctly, that this includes the fact,
> that elementFormDefault="qualifed" in A.xsd is overwritten by
> the value of "unqualified" from B.xsd?
> 
> According to my understanding, when you <include> or <redefine>
> a schema, the including and included schemas are "connected
> at component level" somewhere in memory. This connected
> schema is then referenced by <xs:element ref="pref:Person" />.
> (late binding).
> If the connected schema looked like that,
> 
> <xs:element name="Firma">
>    <xs:complexType>
>       <xs:sequence>
>          <xs:element name="Person">
>             <xs:complexType>
>                <xs:sequence>
>                   <xs:element name="Name" type="xs:string" />
>                </xs:sequence>
>             </xs:complexType>
>          </xs:element>
>       </xs:sequence>
>    </xs:complexType>
> </xs:element>
> 
> the only global declaration in this schema is Firma, so with a value
> of elementFormDefault="unqualified", this should be the only element
> in the instance, that had to be qualified.
> It seems, that <Person> must be qualified aswell, because it is global
> in B.xsd.
> Correct?
> 
> Somehow I expected, that the connected schema decisive? Why is it B.xsd
> in
> one case and the connected schema in the other case?
> 
> Please, help
> 
> Bis bald
> 
> Rainer Becker
> 
> 
Received on Thursday, 20 February 2003 05:03:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT