mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
parser: Make failure to load main document a warning
Revert the change that made failures to load the main document an error. This fixes the --path option of xmllint and xsltproc. Should fix #733.
This commit is contained in:
@@ -180,12 +180,12 @@ xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't report a well-formedness error if an external entity could
|
* Only report a warning if a file could not be found. This should
|
||||||
* not be found. We assume that inputNr is zero for the document
|
* only be done for external entities, but the external entity loader
|
||||||
* entity which is somewhat fragile.
|
* of xsltproc can try multiple paths and assumes that ENOENT doesn't
|
||||||
|
* raise an error and aborts parsing.
|
||||||
*/
|
*/
|
||||||
if ((ctxt->inputNr > 0) &&
|
if (((code == XML_IO_ENOENT) ||
|
||||||
((code == XML_IO_ENOENT) ||
|
|
||||||
(code == XML_IO_NETWORK_ATTEMPT) ||
|
(code == XML_IO_NETWORK_ATTEMPT) ||
|
||||||
(code == XML_IO_UNKNOWN))) {
|
(code == XML_IO_UNKNOWN))) {
|
||||||
if (ctxt->validate == 0)
|
if (ctxt->validate == 0)
|
||||||
|
@@ -10,7 +10,7 @@ import libxml2
|
|||||||
# Memory debug specific
|
# Memory debug specific
|
||||||
libxml2.debugMemory(1)
|
libxml2.debugMemory(1)
|
||||||
|
|
||||||
expect='--> I/O --> error : --> failed to load "missing.xml": No such file or directory\n'
|
expect='--> I/O --> warning : --> failed to load "missing.xml": No such file or directory\n'
|
||||||
err=""
|
err=""
|
||||||
def callback(ctx, str):
|
def callback(ctx, str):
|
||||||
global err
|
global err
|
||||||
|
@@ -90,7 +90,7 @@ run_test(desc="Loading entity without custom callback",
|
|||||||
docpath=startURL, catalog=None,
|
docpath=startURL, catalog=None,
|
||||||
exp_status="not loaded", exp_err=[
|
exp_status="not loaded", exp_err=[
|
||||||
(-1, "I/O "),
|
(-1, "I/O "),
|
||||||
(-1, "error : "),
|
(-1, "warning : "),
|
||||||
(-1, "failed to load \"py://strings/xml/sample.xml\": No such file or directory\n")
|
(-1, "failed to load \"py://strings/xml/sample.xml\": No such file or directory\n")
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ run_test(desc="Retry loading document after unregistering callback",
|
|||||||
docpath=startURL, catalog=catURL,
|
docpath=startURL, catalog=catURL,
|
||||||
exp_status="not loaded", exp_err=[
|
exp_status="not loaded", exp_err=[
|
||||||
(-1, "I/O "),
|
(-1, "I/O "),
|
||||||
(-1, "error : "),
|
(-1, "warning : "),
|
||||||
(-1, "failed to load \"py://strings/xml/sample.xml\": No such file or directory\n")
|
(-1, "failed to load \"py://strings/xml/sample.xml\": No such file or directory\n")
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ run_test(desc="Loading using standard i/o after unregistering all callbacks",
|
|||||||
docpath="tst.xml", catalog=None,
|
docpath="tst.xml", catalog=None,
|
||||||
exp_status="not loaded", exp_err=[
|
exp_status="not loaded", exp_err=[
|
||||||
(-1, "I/O "),
|
(-1, "I/O "),
|
||||||
(-1, "error : "),
|
(-1, "warning : "),
|
||||||
(-1, "failed to load \"tst.xml\": No such file or directory\n")
|
(-1, "failed to load \"tst.xml\": No such file or directory\n")
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ class TestCase(unittest.TestCase):
|
|||||||
domain=libxml2.XML_FROM_IO,
|
domain=libxml2.XML_FROM_IO,
|
||||||
code=libxml2.XML_IO_ENOENT,
|
code=libxml2.XML_IO_ENOENT,
|
||||||
message='failed to load "dummy.xml": No such file or directory\n',
|
message='failed to load "dummy.xml": No such file or directory\n',
|
||||||
level=libxml2.XML_ERR_FATAL,
|
level=libxml2.XML_ERR_WARNING,
|
||||||
file=None,
|
file=None,
|
||||||
line=0)
|
line=0)
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
I/O error : failed to load "test/XInclude/docs/something.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/something.xml": No such file or directory
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
I/O error : failed to load "test/XInclude/docs/b.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/b.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
||||||
|
@@ -1 +1 @@
|
|||||||
I/O error : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
I/O error : failed to load "test/XInclude/docs/a01.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a01.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a02.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a02.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a03.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a03.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a04.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a04.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a05.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a05.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a06.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a06.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a07.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a07.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a08.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a08.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a09.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a09.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a10.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a10.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a11.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a11.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a12.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a12.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a13.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a13.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a14.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a14.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a15.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a15.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/a16.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/a16.xml": No such file or directory
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
I/O error : failed to load "test/XInclude/docs/b.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/b.xml": No such file or directory
|
||||||
I/O error : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/docs/c.xml": No such file or directory
|
||||||
|
@@ -1 +1 @@
|
|||||||
I/O error : failed to load "test/XInclude/without-reader/404.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/without-reader/404.xml": No such file or directory
|
||||||
|
@@ -1 +1 @@
|
|||||||
I/O error : failed to load "test/XInclude/without-reader/b.xml": No such file or directory
|
I/O warning : failed to load "test/XInclude/without-reader/b.xml": No such file or directory
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
I/O error : failed to load "test/schemas/import1_0bc.imp": No such file or directory
|
I/O warning : failed to load "test/schemas/import1_0bc.imp": No such file or directory
|
||||||
./test/schemas/import1_0.xsd:11: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'test/schemas/import1_0bc.imp'. Skipping the import.
|
./test/schemas/import1_0.xsd:11: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'test/schemas/import1_0bc.imp'. Skipping the import.
|
||||||
./test/schemas/import1_0.xsd:16: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at 'test/schemas/import1_0b.imp' for the namespace 'http://BAR', since this namespace was already imported with the schema located at 'test/schemas/import1_0.imp'.
|
./test/schemas/import1_0.xsd:16: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at 'test/schemas/import1_0b.imp' for the namespace 'http://BAR', since this namespace was already imported with the schema located at 'test/schemas/import1_0.imp'.
|
||||||
./test/schemas/import1_0.xsd:26: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://BAR}bar.B' does not resolve to a(n) element declaration.
|
./test/schemas/import1_0.xsd:26: element element: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://BAR}bar.B' does not resolve to a(n) element declaration.
|
||||||
|
Reference in New Issue
Block a user