RE: schemalocation vs. xsi:nonamespaceschemalocation

I think the correct behavior is the schema document that is referenced by
"xsi:noNamespaceSchemaLocation" attribute CANNOT have a target namespace.

If you want to use a schema with targetNamespace, then you should use the
"xsi:schemaLocation" attribute.

--naren




  -----Original Message-----
  From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]On
Behalf Of Manav Singal
  Sent: Tuesday, March 19, 2002 10:07 PM
  To: xmlschema-dev@w3.org; jeni@jenitennison.com; David_E3@Verifone.Com
  Subject: xsi:schemalocation vs. xsi:nonamespaceschemalocation



  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" ?>
  - <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
elementFormDefault="qualified">
  - <xsd:element name="root">
  - <xsd:complexType>
  - <xsd:sequence>
    <xsd:element name="grade" type="abc" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
  - <xsd:simpleType name="abc">
  - <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" ?>
  - <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">
  - <xsd:element name="root">
  - <xsd:complexType>
  - <xsd:sequence>
    <xsd:element name="grade" type="s1:abc" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
  - <xsd:simpleType name="abc">
  - <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

Received on Saturday, 23 March 2002 15:54:25 UTC