mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
enhanced to assure that if xpointer is called for a document, the
* xinclude.c: enhanced to assure that if xpointer is called for a document, the XML_PARSE_NOENT flag is set before parsing the included document so that entities will automatically get taken care of. * xpointer.c: corrected code so that, if an XML_ENTITY_REF node is encountered, it will log it and not crash (bug 135713)
This commit is contained in:
18
xinclude.c
18
xinclude.c
@@ -1361,6 +1361,9 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
|
||||
xmlChar *URL;
|
||||
xmlChar *fragment = NULL;
|
||||
int i = 0;
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
int saveFlags;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_XINCLUDE
|
||||
xmlGenericError(xmlGenericErrorContext, "Loading doc %s:%d\n", url, nr);
|
||||
@@ -1425,7 +1428,22 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
|
||||
#ifdef DEBUG_XINCLUDE
|
||||
printf("loading %s\n", URL);
|
||||
#endif
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
/*
|
||||
* If this is an XPointer evaluation, we want to assure that
|
||||
* all entities have been resolved prior to processing the
|
||||
* referenced document
|
||||
*/
|
||||
saveFlags = ctxt->parseFlags;
|
||||
if (fragment != NULL) { /* if this is an XPointer eval */
|
||||
ctxt->parseFlags |= XML_PARSE_NOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
doc = xmlXIncludeParseFile(ctxt, (const char *)URL);
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
ctxt->parseFlags = saveFlags;
|
||||
#endif
|
||||
if (doc == NULL) {
|
||||
xmlFree(URL);
|
||||
if (fragment != NULL)
|
||||
|
Reference in New Issue
Block a user