- From: Grégoire Pau <gpau@acland.fr>
- Date: Mon, 7 May 2001 20:51:35 +0200
- To: "Martin Gudgin" <marting@develop.com>, <www-xml-schema-comments@w3.org>
Thanks for this quick answer. But, in the elementFormDefault=unqualified mode, I thought that the namespace was inherited from its father tag. Ex. in the following example: <t1:a> <b/> <c> ... </c> </t1:a> b and c are belonging to the t1 associated namespace ? Therefore, there is no way to determine the namespace of an element without the schema when using the unqualified form. Is that correct ? in which part of XML Schema doc can I find more details ? Regards, Grégoire. _____________________________________________________________________ Grégoire Pau Expway ----- Original Message ----- From: "Martin Gudgin" <marting@develop.com> To: "Grégoire Pau" <gpau@acland.fr>; <www-xml-schema-comments@w3.org> Sent: Monday, May 07, 2001 8:26 PM Subject: Re: Qualification, inheritance and import > Comments inline > > ----- Original Message ----- > From: "Grégoire Pau" <gpau@acland.fr> > To: <www-xml-schema-comments@w3.org> > Sent: Monday, May 07, 2001 6:51 PM > Subject: Qualification, inheritance and import > > > Dear all, > > I am currently having trouble with the combined use of > inheritance and imports. Let's have an example : > > - In namespace ns1 : > > <schema > xmlns="http://www.w3.org/2000/10/XMLSchema" > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > targetNamespace="http://www.ns1.com"> > > <element name="A" type="USAddress"/> > > <complexType name="USAddress"> > <complexContent> > <sequence> > <element name="name" type="string"/> > <element name="street" type="string"/> > </sequence> > </complexContent> > </complexType> > </schema> > > > - In namespace ns2 : > > <schema > xmlns="http://www.w3.org/2000/10/XMLSchema" > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > targetNamespace="http://www.ns2.com"> > > <import namespace="http://www.ns1.com" > schemaLocation="http://www.ns1.com/ns1.xsd"/> > > <complexType name="Analyst"> > <complexContent> > <extension base="ns1:USAddress"> > <sequence> > <element name="phone" type="string"/> > </sequence> > </extension> > </complexContent> > </complexType> > > <!-- for later use --> > <element name="email" type="string"/> > </schema> > > > Which one of the following document is valid ? > > - Document 1: > > <ns1:A xsi:type="ns2:Analyst" > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com"> > <ns1:name>John doe</ns1:name> > <ns1:street>Lacepede</ns1:street> > <ns2:phone>...</ns2:phone> > </ns1:A> > > > - Document 2: > > <ns1:A xsi:type="ns2:Analyst" > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com"> > <ns2:name>John doe</ns2:name> > <ns2:street>Lacepede</ns2:street> > <ns2:phone>...</ns2:phone> > </ns1:A> > > > <MJG> > Neither! The following would be valid; > > <ns1:A xsi:type="ns2:Analyst" > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com"> > <name>John doe</name> > <street>Lacepede</street> > <phone>...</phone> > </ns1:A> > > Local element declarations are unqualified by default. Put > elementFormDefault='qualified' on the schema element for ns1 and ns2 to make > Document 1 valid. > </MJG> > > Then, what about element ref ? > > Let's define a new schema in a new namespace : > > <schema > xmlns="http://www.w3.org/2000/10/XMLSchema" > xmlns:ns2="http://www.ns2.com" > xmlns:ns3="http://www.ns3.com" > targetNamespace="http://www.ns3.com"> > > <import namespace="http://www.ns2.com" > schemaLocation="http://www.ns2.com/ns2.xsd"/> > > <complexType name="ModernAnalyst"> > <complexContent> > <extension base="ns2:Analyst"> > <sequence> > <element ref="ns2:email"/> > </sequence> > </extension> > </complexContent> > </complexType> > </schema> > > Then which one of the following document is valid ? > > <ns1:A xsi:type="ns3:ModernAnalyst"> > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > xmlns:ns3="http://www.ns3.com"> > <??:name>John doe</??:name> > <??:street>Lacepede</??:street> > <??:phone>...</??:phone> > <ns3:email>...</ns3:email> > </ns1:A> > > <ns1:A xsi:type="ns3:ModernAnalyst"> > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > xmlns:ns3="http://www.ns3.com"> > <??:name>John doe</??:name> > <??:street>Lacepede</??:street> > <??:phone>...</??:phone> > <ns2:email>...</ns2:email> > </ns1:A> > > <MJG> > Valid document would be > > <ns1:A xsi:type="ns3:ModernAnalyst"> > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > xmlns:ns3="http://www.ns3.com"> > <name>John doe</name> > <street>Lacepede</street> > <phone>...</phone> > <ns2:email>...</ns2:email> > </ns1:A> > > If you put elementFormDefault='qualified' on the schema element for ns1 and > ns2 the following would be valid; > > <ns1:A xsi:type="ns3:ModernAnalyst"> > xmlns:xsi="http://www....." > xmlns:ns1="http://www.ns1.com" > xmlns:ns2="http://www.ns2.com" > xmlns:ns3="http://www.ns3.com"> > <ns1:name>John doe</ns1:name> > <ns1:street>Lacepede</ns1:street> > <ns2:phone>...</ns2:phone> > <ns2:email>...</ns2:email> > </ns1:A> > > Hope this helps, > > Martin Gudgin > DevelopMentor > </MJG> > > > > >
Received on Monday, 7 May 2001 14:56:14 UTC