After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 552479 - xinclude with parse="text" does not use the selected externalEntityLoader
xinclude with parse="text" does not use the selected externalEntityLoader
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.31
Other All
: Normal critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks: 675007
 
 
Reported: 2008-09-16 11:00 UTC by olaf
Modified: 2012-05-10 13:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed Patch for bug 552479 (358 bytes, patch)
2008-09-18 15:02 UTC, olaf
none Details | Review
Proposed Patch for bug 552479 (fixed) (1006 bytes, patch)
2008-09-19 09:34 UTC, olaf
needs-work Details | Review
Use externalEntityLoader, set the encoder (1.78 KB, patch)
2012-05-02 18:06 UTC, Shaun McCance
none Details | Review

Description olaf 2008-09-16 11:00:13 UTC
Please describe the problem:
Running:

xmllint --nonet --xinclude test.xml

on

<?xml version="1.0" encoding="utf-8"?>
<root>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="http://wikipedia.sevenval.com/sitemap.xml" parse="text"/>
</root>

loads the referenced document, even though it is on the net. Without parse="text" it works as expected

Steps to reproduce:
See above




Actual results:
The text ist loaded from the net

Expected results:
No loading

Does this happen every time?
Yes

Other information:
It seems to me for parse="text" the Loader set by xmlSetExternalEntityLoader is ignored/ not used
Comment 1 olaf 2008-09-18 15:02:47 UTC
Created attachment 118954 [details] [review]
Proposed Patch for bug 552479

With the patch it works as expected
Comment 2 olaf 2008-09-19 09:34:47 UTC
Created attachment 118992 [details] [review]
Proposed Patch for bug 552479 (fixed)
Comment 3 Daniel Veillard 2009-01-18 21:06:05 UTC
Okay I looked at this but unfortunately the patch breaks
XInclude, that can be seen easilly just by running the 
regression tests with it applied. There was a memory leak
on the return(-1) which was trivial to fix, but the real
problem is that it now ignores the encoding provided (if
provided) making XInclude non conformant anymore.
A better solution using the general resolver is still the
right way to go, but it should plug the encoding converter.
I didn't really had time to chase it, so it's still not
fixed, unfortunately,

  thanks for the initial patch, but it's not usable as-is,

Daniel
Comment 4 Piotr Banski 2009-11-18 19:55:29 UTC
As is predictable from the above exchange, the bug persists for libxml2 2.7.3-1 under cygwin.
Comment 5 Shaun McCance 2012-05-02 18:06:43 UTC
Created attachment 213316 [details] [review]
Use externalEntityLoader, set the encoder

Building off the previous patch, but also setting the encoder. This passed 'make tests' for me.
Comment 6 Daniel Veillard 2012-05-03 01:56:29 UTC
Comment on attachment 213316 [details] [review]
Use externalEntityLoader, set the encoder

Looks fine to me, please
submit upstream :-)
Comment 7 Daniel Veillard 2012-05-10 13:02:27 UTC
Thanks Shaun, I commited it :-)

http://git.gnome.org/browse/libxml2/commit/?id=4cf7325e1f5d6b727bae8f01851c759e49a9d05d

 thanks again !

Daniel