- From: Rainer Becker <rainerbecker.mail@t-online.de>
- Date: Thu, 20 Feb 2003 10:34:12 +0100
- To: xmlschema-dev@w3.org
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 04:34:26 UTC