W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

xsi:schemalocation vs. xsi:nonamespaceschemalocation

From: Manav Singal <manav_singal@infy.com>
Date: Wed, 20 Mar 2002 01:07:26 -0500 (EST)
Message-ID: <2B721C6525F0D411B1E900B0D0226BDDAF2C7B@mohmsg01.ad.infosys.com>
To: <xmlschema-dev@w3.org>, <jeni@jenitennison.com>, <David_E3@Verifone.Com>
 

Hi,

We are faced with big confusion that if a XML document has xsi:noNamespaceSchemaLocation, then Schema used for creation of this XML doc needs to have targetNamespace or not.

e.g. I am creating a XML doc given below called noSchemaXMLDoc.xml

<root xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="noSchemalocate.xsd">

  <grade>a</grade> 
  </root>
 
for this is it mandatory to use noSchemalocate.xsd with no targetNamespace, given below
 
<?xml version="1.0" encoding="UTF-8" ?> 
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:element name="root">
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:complexType>
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:sequence>
  <xsd:element name="grade" type="abc" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:simpleType name="abc">
 <file:///C:/ManavJava/noSchemalocate.xsd#> - <xsd:restriction base="xsd:string">
  <xsd:enumeration value="a" /> 
  <xsd:enumeration value="b" /> 
  <xsd:enumeration value="c" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:schema>
 
or can we use schema with targetNamespace, given below
 
<?xml version="1.0" encoding="UTF-8" ?> 
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:schema xmlns:s1="http://www.schemaValid.com/s1ns" targetNamespace="http://www.schemaValid.com/s1ns" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:element name="root">
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:complexType>
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:sequence>
  <xsd:element name="grade" type="s1:abc" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:simpleType name="abc">
 <file:///C:/ManavJava/schemanamespace.xsd#> - <xsd:restriction base="xsd:string">
  <xsd:enumeration value="a" /> 
  <xsd:enumeration value="b" /> 
  <xsd:enumeration value="c" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:schema>
 
Need your confirmation on this.
 
Regards,
Manav Singal
Programmer Analyst
Communication Software Group
 




infy.jpe
(image/jpeg attachment: infy.jpe)

Received on Thursday, 21 March 2002 12:03:55 GMT

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