GNOME Bugzilla – Bug 139520
xinclude fallback repeats
Last modified: 2009-08-15 18:40:50 UTC
When running 'xmllint --xinclude' on a document with multiple non-nested xincludes with fallbacks, the fallback gets repeated in the output. a.xml: <a> <xi:include href="b.xml" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:fallback>There is no b.xml ... </xi:fallback> </xi:include> <xi:include href="c.xml" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:fallback>There is no c.xml ... </xi:fallback> </xi:include> </a> xmllint --xinclude a.xml I/O warning : failed to load external entity "b.xml" I/O warning : failed to load external entity "c.xml" I/O warning : failed to load external entity "c.xml" <?xml version="1.0"?> <a> There is no b.xml ... There is no c.xml ... There is no c.xml ... </a>
*** Bug 140000 has been marked as a duplicate of this bug. ***
I made a small enhancement to the fallback processing which (I hope) will fix this problem. I also added your testfile to the regression tests. Fixed source is in CVS (xinclude.c). Thanks for the report.
This should be closed by release 2.6.9, thanks, Daniel
This bug is still present in 2.6.9. Here's my test: rnowakow@murdock:~/fallback_test$ cat a.xml <?xml version="1.0" encoding="UTF-8"?> <a> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml"> <xi:fallback> <tag>b.xml was not found</tag> </xi:fallback> </xi:include> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml"> <xi:fallback> <tag>c.xml was not found</tag> </xi:fallback> </xi:include> </a> rnowakow@murdock:~/fallback_test$ xmllint --xinclude a.xml I/O warning : failed to load external entity "b.xml" I/O warning : failed to load external entity "c.xml" I/O warning : failed to load external entity "c.xml" <?xml version="1.0" encoding="UTF-8"?> <a> <tag>b.xml was not found</tag> <tag>c.xml was not found</tag> <tag>c.xml was not found</tag> </a>
Sorry, but I cannot reproduce this. As mentioned previously, your test program was added to the "regression tests" of the library, and when I compile release 2.6.9 the tests pass: wbrack@billsuper libxml2-2.6.9 $ ./xmllint --version /home/wbrack/libxml2-2.6.9/.libs/lt-xmllint: using libxml version 20609 compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer XInclude Iconv Unicode Regexps Automata Schemas wbrack@billsuper libxml2-2.6.9 $ cat test/XInclude/docs/fallback2.xml <a> <xi:include href="b.xml" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:fallback>There is no b.xml ... </xi:fallback> </xi:include> <xi:include href="c.xml" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:fallback>There is no c.xml ... </xi:fallback> </xi:include> </a> wbrack@billsuper libxml2-2.6.9 $ make XIncludetests ## XInclude regression tests ## XInclude xmlReader regression tests wbrack@billsuper libxml2-2.6.9 $ cat result/XInclude/fallback2.xml <?xml version="1.0"?> <a> There is no b.xml ... There is no c.xml ... </a> Can you please re-check your installation, and your library paths, and let me know the result? Thanks. Bill
In my comment above, I included a NEW example that breaks the fallback. It's different than the original example. The new one contains an XML tag inside the fallback(which breaks the fallback code again). The old one didn't. Here's the new example again(notice the tag inside the fallback): rnowakow@murdock:~/fallback_test$ cat a.xml <?xml version="1.0" encoding="UTF-8"?> <a> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml"> <xi:fallback> <tag>b.xml was not found</tag> </xi:fallback> </xi:include> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml"> <xi:fallback> <tag>c.xml was not found</tag> </xi:fallback> </xi:include> </a> rnowakow@murdock:~/fallback_test$ xmllint --xinclude a.xml I/O warning : failed to load external entity "b.xml" I/O warning : failed to load external entity "c.xml" I/O warning : failed to load external entity "c.xml" <?xml version="1.0" encoding="UTF-8"?> <a> <tag>b.xml was not found</tag> <tag>c.xml was not found</tag> <tag>c.xml was not found</tag> </a>
Ah, yes - sorry about that ... my eyes see only what they want to see :-). OK, I have done a little further enhancement of xinclude.c which (I hope) will fix the problem (at least it works for me): bill@billsuper bug139520 $ ../xmltest/xmllint --xinclude --noblanks bug2.xml I/O warning : failed to load external entity "b.xml" I/O warning : failed to load external entity "c.xml" <?xml version="1.0" encoding="UTF-8"?> <a><tag>b.xml was not found</tag><tag>c.xml was not found</tag></a> Fixed source is in CVS - thanks for your patience. Bill
(sorry about all the bugzilla messages - it's my fumble fingers at work)
This should be closed in libxml2-2.6.11, thanks, Daniel