RE: Imports and namespaces

The schema composition rules give a lot of freedom to implementations to do
different things in this kind of situation. In particular, the rules for
xs:import hint quite strongly that if you import a namespace that the
processor thinks it already knows about, then it is entitled to assume that
you are probably loading two copies of the same schema from different places
and it can ignore one of them. I don't know exactly what the rules applied
by XSV are, but as a general rule it's probably best to import only one
schema document for each namespace; if necessary that can be a document that
does nothing other than xs:include your two existing schema documents.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Cesar Ariza (gmd)
> Sent: 24 June 2008 05:55
> To: xmlschema-dev@w3.org
> Subject: Imports and namespaces
> 
> 
> Dear All,
> 
> I have some questions about using imports with the same namepace.
> 
> In the code below I have two imports, both files have the 
> same namespace inside.  I don´t want to import the container 
> library because I'll use only two elements.
> 
> Then, at "parsing time" some parser (XSV version: XSV 3.1-1 
> of 2007/12/11
> 16:20:05) I receive a message "
> Attempt to load a schema document from
> http://www.foo.com/schemas/Proyectos/THECOP/Core/tipoCodAdjudi
> cacion.xsd
> (source: import) for
> http://www.foo2.com/THE-XML/schemas/Proyectos/THECOP/Core-v1, 
> skipped, other docs already loaded for this namespace:
> http://www.foo.com/schemas/Proyectos/THECOP/Core/tipoNumResolu
> cion.xsd"
> 
> It is clear the error from the parser, but the XML Schema 
> language allows to do that, isn’t it?
> 
> Any clue to solve this problem?
> 
> Cheers,
> 
> Cesar Ariza
> 
> 
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> - <xsd:schema elementFormDefault="qualified" id="adjudicacion"
> targetNamespace="http://www.foo2.com/THE-XML/schemas/Proyectos
/THECOP/Adquis
> icion-v1" version="1.0" xmlns:dc="http://purl.org/dc/terms/"
> xmlns:secadq="http://www.foo2.com/THE-XML/schemas/Proyectos/TH
ECOP/Adquisici
> on-v1"
> xmlns:seccor="http://www.foo2.com/THE-XML/schemas/Proyectos/TH
ECOP/Core-v1"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <xsd:include schemaLocation="tipoResolucionAdjudicacion.xsd" />
>   <xsd:include schemaLocation="tipoCabeceraAdjudicacion.xsd" />
>   <xsd:include schemaLocation="tipoLineaItemAdj.xsd" />
>   <xsd:import
> namespace="http://www.foo2.com/THE-XML/schemas/Proyectos/THECO
P/Core-v1"
> schemaLocation="../Core/tipoListaDocumentoAdjunto.xsd" />
>   <xsd:import
> namespace="http://www.foo2.com/THE-XML/schemas/Proyectos/THECO
P/Core-v1"
> schemaLocation="../Core/tipoListaParte.xsd" />
> - <xsd:complexType name="tipoAdjudicacion">
> - <xsd:annotation>
> - <xsd:appinfo>
>  
> <dc:identifier>http://www.foo2.com/THE-XML/schemas/Proyectos/T
HECOP/Adquisic
> ion-v1/tipoAdjudicacion</dc:identifier>
>   <dc:date>2008-01-30</dc:date>
>   <dc:description xml:lang="es">Es el acto mediante el cual 
> se determinan a los aceptantes y/o adjudicatarios, de un acto 
> jurídico generador de obligaciones, celebrado por una entidad 
> estatal.</dc:description>
>   <dc:hasVersion>1.0</dc:hasVersion>
>   </xsd:appinfo>
>   </xsd:annotation>
> - <xsd:sequence>
>   <xsd:element ref="secadq:resolucionAdjudicacion" />
>   <xsd:element ref="secadq:cabeceraAdjudicacion" />
>   <xsd:element ref="secadq:detalleAdjudicacion" />
>   <xsd:element minOccurs="0" ref="seccor:documentosAdjuntos" />
>   <xsd:element minOccurs="0" ref="seccor:proveedoresNoAdjudicados" />
>   </xsd:sequence>
>   </xsd:complexType>
>   </xsd:schema>
> 
> 
> 
> 
> 

Received on Tuesday, 24 June 2008 23:06:13 UTC