- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 10 Jul 2002 09:01:03 +0100
- To: "zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN" <michael.marchegay@rd.francetelecom.com>
- CC: xmlschema-dev@w3c.org
Hi Michaël,
> I have a question concerning importation: if two schema have the
> same targetNamespace, can they be both imported by a third schema?
As Ajay said, most validators will ignore the second import, so while
you *can* have two imports for the same namespace, it won't
necessarily give you what you want. It's better to create a schema
that includes both of the other schemas, and then import that:
<!--A.xsd-->
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://foo.com/A.xsd">
<xsd:import namespace="http://foo.com/foo" schemaLocation="D.xsd"/>
<xsd:element name="e1" type="xsd:integer"/>
</xsd:schema>
<!--D.xsd-->
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://foo.com/foo">
<xsd:include schemaLocation="B.xsd" />
<xsd:include schemaLocation="C.xsd" />
</xsd:schema>
<!--B.xsd-->
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://foo.com/foo">
<xsd:element name="e2" type="xsd:integer"/>
</xsd:schema>
<!--C.xsd-->
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://foo.com/foo">
<xsd:element name="e3" type="xsd:integer"/>
</xsd:schema>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 10 July 2002 04:01:05 UTC