diff --git a/parserInternals.c b/parserInternals.c index 6e76dc26..2e3119ab 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -219,19 +219,20 @@ xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri) if (ctxt == NULL) return; - /* - * Only report a warning if a file could not be found. This should - * only be done for external entities, but the external entity loader - * of xsltproc can try multiple paths and assumes that ENOENT doesn't - * raise an error and aborts parsing. - */ if (((code == XML_IO_ENOENT) || - (code == XML_IO_NETWORK_ATTEMPT) || (code == XML_IO_UNKNOWN))) { + /* + * Only report a warning if a file could not be found. This should + * only be done for external entities, but the external entity loader + * of xsltproc can try multiple paths and assumes that ENOENT doesn't + * raise an error and aborts parsing. + */ if (ctxt->validate == 0) level = XML_ERR_WARNING; else level = XML_ERR_ERROR; + } else if (code == XML_IO_NETWORK_ATTEMPT) { + level = XML_ERR_ERROR; } else { level = XML_ERR_FATAL; } diff --git a/python/tests/input_callback.py b/python/tests/input_callback.py index b24c5c85..c4c8e40f 100755 --- a/python/tests/input_callback.py +++ b/python/tests/input_callback.py @@ -99,7 +99,7 @@ libxml2.registerInputCallback(my_input_cb) run_test(desc="Loading entity with custom callback", docpath=startURL, catalog=None, exp_status="loaded", exp_err=[ - ( 3, 'failed to load "http://example.com/dtds/sample.dtd": Attempt to load network entity\n'), + ( 4, 'failed to load "http://example.com/dtds/sample.dtd": Attempt to load network entity\n'), ( 4, "Entity 'sample.entity' not defined\n") ])