502960 provide namespace stack when parsing entity

* parser.c: copy the entity stack
* SAX2.c: fix the warning message for default entities
This commit is contained in:
Daniel Veillard 2009-08-26 15:57:20 +02:00
parent a6c76a26ca
commit 74eaec1496
2 changed files with 18 additions and 3 deletions

11
SAX2.c
View File

@ -2283,9 +2283,14 @@ xmlSAX2StartElementNs(void *ctx,
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
return;
}
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s was not found\n",
prefix, NULL);
if (prefix != NULL)
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s was not found\n",
prefix, NULL);
else
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace default prefix was not found\n",
NULL, NULL);
}
}

View File

@ -12618,6 +12618,9 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
xmlNodePtr last = NULL;
int size;
xmlParserErrors ret = XML_ERR_OK;
#ifdef SAX2
int i;
#endif
if (((oldctxt->depth > 40) && ((oldctxt->options & XML_PARSE_HUGE) == 0)) ||
(oldctxt->depth > 1024)) {
@ -12644,6 +12647,13 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
#ifdef SAX2
/* propagate namespaces down the entity */
for (i = 0;i < oldctxt->nsNr;i += 2) {
nsPush(ctxt, oldctxt->nsTab[i], oldctxt->nsTab[i+1]);
}
#endif
oldsax = ctxt->sax;
ctxt->sax = oldctxt->sax;
xmlDetectSAX2(ctxt);