diff --git a/ChangeLog b/ChangeLog index 9b82fc4e..70c5ce95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 18 12:17:41 CET 2002 Daniel Veillard + + * SAX.c entities.c: fixed a couple of conformances issues deep + into the validation code (standalone and undeclared Notations) + Mon Feb 18 00:17:24 CET 2002 Daniel Veillard * parser.c: fixed #71741 supid typo an a bug about encoding parsing diff --git a/SAX.c b/SAX.c index 35c316bc..ae31245e 100644 --- a/SAX.c +++ b/SAX.c @@ -344,7 +344,30 @@ getEntity(void *ctx, const xmlChar *name) "SAX.getEntity(%s)\n", name); #endif - ret = xmlGetDocEntity(ctxt->myDoc, name); + if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) { + if (ctxt->inSubset == 2) { + ctxt->myDoc->standalone = 0; + ret = xmlGetDocEntity(ctxt->myDoc, name); + ctxt->myDoc->standalone = 1; + } else { + ret = xmlGetDocEntity(ctxt->myDoc, name); + if (ret == NULL) { + ctxt->myDoc->standalone = 0; + ret = xmlGetDocEntity(ctxt->myDoc, name); + if (ret != NULL) { + if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) + ctxt->sax->error(ctxt, + "Entity(%s) document marked standalone but require external subset\n", + name); + ctxt->valid = 0; + ctxt->wellFormed = 0; + } + ctxt->myDoc->standalone = 1; + } + } + } else { + ret = xmlGetDocEntity(ctxt->myDoc, name); + } if ((ret != NULL) && (ctxt->validate) && (ret->children == NULL) && (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { /* @@ -617,10 +640,15 @@ unparsedEntityDecl(void *ctx, const xmlChar *name, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n", name, publicId, systemId, notationName); #endif - if (ctxt->validate && ctxt->wellFormed && - ctxt->myDoc && ctxt->myDoc->extSubset) - ctxt->valid &= xmlValidateNotationUse(&ctxt->vctxt, ctxt->myDoc, + if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc) { + int ret; + ret = xmlValidateNotationUse(&ctxt->vctxt, ctxt->myDoc, notationName); + if (ret == 0) { + ctxt->wellFormed = 0; + ctxt->valid = 0; + } + } if (ctxt->inSubset == 1) { ent = xmlAddDocEntity(ctxt->myDoc, name, XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, diff --git a/entities.c b/entities.c index af65a38c..4f6f52a6 100644 --- a/entities.c +++ b/entities.c @@ -385,11 +385,14 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { if (cur != NULL) return(cur); } - if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->extSubset->entities; - cur = xmlGetEntityFromTable(table, name); - if (cur != NULL) - return(cur); + if (doc->standalone != 1) { + if ((doc->extSubset != NULL) && + (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + cur = xmlGetEntityFromTable(table, name); + if (cur != NULL) + return(cur); + } } } if (xmlPredefinedEntities == NULL)