diff options
Diffstat (limited to 'xmlschemas.c')
-rw-r--r-- | xmlschemas.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/xmlschemas.c b/xmlschemas.c index aec901a..f6b86dd 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -10346,6 +10346,8 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, /* 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. */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, "The schema document '%s' cannot be imported, since " @@ -10354,6 +10356,8 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, goto exit; } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) { /* We imported and then try to include/redefine a schema. */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, "The schema document '%s' cannot be included or " @@ -10404,6 +10408,9 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * URGENT TODO: We should report a warning here. * res = XML_SCHEMAP_SRC_IMPORT; */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; + xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_SKIP_SCHEMA, invokingNode, NULL, @@ -10484,7 +10491,8 @@ doc_load: if (schemaDoc->URL != NULL) schemaLocation = xmlDictLookup(pctxt->dict, schemaDoc->URL, -1); - + else + schemaLocation = BAD_CAST "in_memory_buffer"; } else if ((schemaLocation != NULL) || (schemaBuffer != NULL)) { xmlParserCtxtPtr parserCtxt; @@ -10547,7 +10555,7 @@ doc_load: xmlSchemaCustomErr(ACTXT_CAST pctxt, res, invokingNode, NULL, "Failed to parse the XML resource '%s'", - schemaLocation, NULL); + schemaLocation, NULL); } } xmlFreeParserCtxt(parserCtxt); @@ -21898,6 +21906,20 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, } /** + * xmlSchemaAugmentImportedIDC: + * @imported: the imported schema + * + * Creates an augmented IDC definition for the imported schema. + */ +static void +xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) { + if (imported->schema->idcDef != NULL) { + xmlHashScan(imported->schema->idcDef , + (xmlHashScanner) xmlSchemaAugmentIDC, vctxt); + } +} + +/** * xmlSchemaIDCNewBinding: * @idcDef: the IDC definition of this binding * @@ -25943,7 +25965,7 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) xmlRegExecNextValues(inode->regexCtxt, &nbval, &nbneg, &values[0], &terminal); ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL); - if (ret <= 0) { + if ((ret<0) || ((ret==0) && (!INODE_NILLED(inode)))) { /* * Still missing something. */ @@ -27893,13 +27915,12 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { */ pctxt->ownsConstructor = 1; } - /* - * Augment the IDC definitions. + /* + * Augment the IDC definitions for the main schema and all imported ones + * NOTE: main schema if the first in the imported list */ - if (vctxt->schema->idcDef != NULL) { - xmlHashScan(vctxt->schema->idcDef, - (xmlHashScanner) xmlSchemaAugmentIDC, vctxt); - } + xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt); + return(0); } |