582906 XSD validating multiple imports of the same schema
* xmlschemas.c: When validating a schema that includes the same file
that has no targetNamespace defined an internal erro was thrown,
depending on the orig namespace that should be allowed though
* test/schemas/582906-* result/schemas/582906-*: 2 tests case, one
where this is allowed, and one where this is forbidden
diff --git a/xmlschemas.c b/xmlschemas.c
index e621120..70fe3eb 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -11039,14 +11039,15 @@
*/
isChameleon = 1;
if (bucket->parsed &&
- (bucket->targetNamespace != pctxt->targetNamespace)) {
- /*
- * This is a sanity check, I dunno yet if this can happen.
- */
- PERROR_INT("xmlSchemaParseIncludeOrRedefine",
- "trying to use an already parsed schema for a "
- "different targetNamespace");
- return(-1);
+ bucket->origTargetNamespace != NULL) {
+ xmlSchemaCustomErr(ACTXT_CAST pctxt,
+ XML_SCHEMAP_SRC_INCLUDE,
+ node, NULL,
+ "The target namespace of the included/redefined schema "
+ "'%s' has to be absent or the same as the "
+ "including/redefining schema's target namespace",
+ schemaLocation, NULL);
+ goto exit_error;
}
bucket->targetNamespace = pctxt->targetNamespace;
}