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 105994 - URI are mismatch for identical documents
URI are mismatch for identical documents
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.5.2
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2003-02-13 15:21 UTC by Kupriyanov Anatolij
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kupriyanov Anatolij 2003-02-13 15:21:37 UTC
String 765:
Please, change
ctxt->myDoc->URL = xmlStrdup((const xmlChar *) ctxt->input->filename);
to
ctxt->myDoc->URL = xmlStrdup(xmlSaveUri(xmlParseURI(ctxt->input-
>filename)));

, else in some cases identical documents would be parse several times in 
XSLT.
Comment 1 Kupriyanov Anatolij 2003-02-17 16:29:38 UTC
I suggest next code for 'xmlNormalizeWindowsPath' function. It is 
necessary for forming equal URL's for same documents.

xmlChar *
xmlNormalizeWindowsPath(const xmlChar *path)
{
    int len, i = 0;
    xmlChar *ret;
	xmlURIPtr uri;

    if (path == NULL)
	return(NULL);

	if((uri = xmlParseURI(path)) != NULL)
	{
		xmlFreeURI(uri);
		return xmlStrdup(path);
	}
	uri = xmlCreateURI();

	uri->path = xmlStrdup(path);

	len = xmlStrlen(uri->path);
    while (i < len) {
	if (uri->path[i] == '\\')
	    uri->path[i] = '/';
	i++;
    }
	ret = xmlSaveUri(uri);
	xmlFreeURI(uri);
    return(ret);
}
Comment 2 Igor Zlatkovic 2003-02-19 15:25:03 UTC
I have partially fixed this. 

The first proposition about changing ctxt->myDoc->URL = ... leaks
memory, so I changed it a little bit.

The xmlNormalizeWindowsPath has been obsoleted and the new
xmlCanonicPath now takes over its place. It works similarily to what
you propose above, so I think your problem is solved.

About the actual problem you mentioned, namely that identical
documents are being parsed multiple times, that has not been solved
with the above, and I doubt that can be solved in a short term. I'll
therefore assign this report to pending, the problem needs a general
analysis.
Comment 3 Kupriyanov Anatolij 2003-02-19 16:59:15 UTC
For the first change:
Please check, that your change works!!! After this change I have a 
new bug - if filename is non-wellformed (for example spaces in path) 
it is not works. In other words filename must be parseable as URI.
For this requirement I make changes in xmlNormalizeWindowsPath, it 
solve problems in my application, but it is not solve problem in 
library.
I suppose, that solve of problem requires accurate separation between 
URL's and paths in whole library.

This problem I see then I try preload big XML-document, which uses in 
several transformers.
I load document using xmlParseFile() and place it in transformer 
using xsltNewDocument. And as result the doc->URL mismatchs with URL 
of document loaded by xsl:document() function durning transformation.
Comment 4 Daniel Veillard 2003-02-25 12:11:19 UTC
This should be closed in libxml2 release 2.5.4 and libxslt release 1.0.27,

  thanks,

Daniel