Commit 2875770e authored by Daniel Veillard's avatar Daniel Veillard
Browse files

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
parent 82ac6b02
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
......
......@@ -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,
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment