mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-08 17:42:14 +03:00
fixed a couple of conformances issues deep into the validation code
* SAX.c entities.c: fixed a couple of conformances issues deep into the validation code (standalone and undeclared Notations) Daniel
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Mon Feb 18 12:17:41 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* 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 <daniel@veillard.com>
|
||||
|
||||
* parser.c: fixed #71741 supid typo an a bug about encoding parsing
|
||||
|
34
SAX.c
34
SAX.c
@@ -344,7 +344,30 @@ getEntity(void *ctx, const xmlChar *name)
|
||||
"SAX.getEntity(%s)\n", name);
|
||||
#endif
|
||||
|
||||
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,
|
||||
|
@@ -385,13 +385,16 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
|
||||
if (cur != NULL)
|
||||
return(cur);
|
||||
}
|
||||
if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) {
|
||||
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)
|
||||
xmlInitializePredefinedEntities();
|
||||
table = xmlPredefinedEntities;
|
||||
|
Reference in New Issue
Block a user