import a schema that is not guaranteed to exist

Hello,


Is there a way to get the validator to ignore an import or include statement
when the schemaLocation is not valid?  Schema1.xsd is basically a layout
schema which imports Schema2.xsd and Schema3.xsd.  Schema2.xsd defines a
group construct of elements.  Sometimes there will be a schema, Schema3.xsd,
that redefines the group defined by Schema2.xsd.  As written, if Schema3.xsd
does not exist, Schema1.xsd is not valid.  

Schema1.xsd
----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.aaabbb.com/" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  xmlns:person="http://www.aaabbb.com/" 
  xmlns:info="http://www.aaabbb.com/INFO/" 
  elementFormDefault="qualified" version="1.0">

  <xs:import namespace="http://www.aaabbb.com/INFO/" 
    schemaLocation="Schema2.xsd"
    schemaLocation="Schema3.xsd"/>

  <xs:element name="PERSON">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="info:INFORMATION"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
Schema2.xsd
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.aaabbb.com/INFO/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:info="http://www.aaabbb.com/INFO/" elementFormDefault="qualified"
version="1.0">
  <xs:group name="INFORMATION">
    <xs:sequence>
      <xs:element name="NAME" type="xs:string"/>
    </xs:sequence>
  </xs:group>
</xs:schema>
 
Schema3.xsd
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.aaabbb.com/INFO/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:info="http://www.aaabbb.com/INFO/" elementFormDefault="qualified"
version="1.0">
  <xs:redefine schemaLocation="Schema2.xsd">
    <xs:group name="INFORMATION">
      <xs:sequence>
        <xs:element name="NAME" type="xs:string"/>
        <xs:element name="PHONE" type="xs:string"/>
      </xs:sequence>
    </xs:group>
  </xs:redefine>
</xs:schema>
 
Person.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<person:PERSON xmlns:person="http://www.aaabbb.com/"
xmlns:info="http://www.aaabbb.com/INFO/" xmlns="http://www.aaabbb.com/"
xmlns:info="http://www.aaabbb.com/INFO/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.aaabbb.com/
F:\user-space\scott\FAILURE\Schema1.xsd">
  <info:NAME>Fred Dred</info:NAME>
  <info:PHONE>(111) 111-1111</info:PHONE>
</person:PERSON>
 
Basically, I want to import a schema that is not guaranteed to exist.  Is
this possible?

Sorry for the lame example.

Any help is appreciated.

Thanks,

Scott Gordon

Received on Thursday, 27 February 2003 14:21:40 UTC