Re: [xml] including and importing schemas



Hi all,
I have used the latest version of libxml2 (2.6.27). I launched the validation process using xmllint but the response was the same:

'{http://www.w3.org/2001/XMLSchema}import': The schema document 'BaseTypes.xsd' cannot be imported, since it was already included or redefined. As I wrote the schemas are organized as shown in the attached picture. I had a look of the xmlschemas.c file that do the parsing and the error comes from a check performed inside the xmlSchemaAddSchemaDoc(..) function, here is the code chunk that does the check:

/* Did we already fetch the doc? */
if (bkt != NULL) { /* TODO: The following nasty cases will produce an error. */
   if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) {
       /* We included/redefined and then try to import a schema. */
       xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
       invokingNode, NULL,
       "The schema document '%s' cannot be imported, since "
       "it was already included or redefined",
       schemaLocation, NULL);
       goto exit;
   } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) {
       /* We imported and then try to include/redefine a schema. */
       xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
       invokingNode, NULL,
       "The schema document '%s' cannot be included or "
       "redefined, since it was already imported",
       schemaLocation, NULL);
       goto exit;
} }

Can anyone suggest how to escape the problem ? Thanks.

Luigi


Daniel Veillard wrote:
On Wed, Jan 10, 2007 at 04:55:23PM +0100, Luigi Selmi wrote:
Hi All,
we are using libxml2 in order to validate our xml schemas. The xsd files are organized as stated in the following:

* RichiestaSAIA.xsd (targetNamespacePrefix: ap5) includes ComAnagTypes.xsd and imports RichiestaAPR4.xsd * ComAnagTypes (targetNamespacePrefix: ap5) includes RichiestaMacroTypes.xsd * RichiestaMacroTypes.xsd (targetNamespacePrefix: ap5) includes BaseTypes.xsd
  * RichiestaAPR4.xsd (targetNamespacePrefix: apr4) imports BaseTypes.xsd

A picture of the schemas structure has been attached. The libxml2 validation function reports the following error:

/Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}import': The schema document 'BaseTypes.xsd' cannot be imported, since it was already included or redefined. /

All the other validation tools, W3C Schema validation service, XMLSpy, XML-Beans, validate the schemas without reporting any error or warning. Can anyone suggest an explanation for this problem ? Thanks in advance.

  That could be a bug ... or not. Use the latest release,

Daniel

GIF image



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]