Re: [xml] xmlReadFile with filename instead of URL?

On Fri, Mar 30, 2007 at 09:43:43AM +1000, Michael Day wrote:
The behaviour only seems to trigger when you configure --without-zlib. I 
don't know why yet, but there are zlib specific #ifdefs in the loading 
and URL mangling code, so there could be something funny going on that 
isn't triggered when zlib is disabled.

Okay, I found the bug, it's very simple.

  haha :-) Cool !

So I suggest this patch to xmlFileOpen in xmlIO.c:

    retval = xmlFileOpen_real(filename);
    if (retval == NULL) {
        unescaped = xmlURIUnescapeString(filename, 0, NULL);
        if (unescaped != NULL) {
            retval = xmlFileOpen_real(unescaped);
    return retval;

With this code the file "hello%2Fworld.xml" will be loaded first, and 
only if it is not found will "hello/world.xml" be loaded. But yeah, I 
would rather delete that entire if test, as it seems to me that any URL 
unescaping should be handled a lot earlier before xmlFileOpen sees it.

  Sounds better I made the change in SVN,

   thanks a lot !


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]