Re: [xml] spaces in uri, again




And does an argument for xmlParseFile (for
example) should be already escaped? 

  I would expect the argument to be passed unescaped. Escaping should
normally be a no-op on an already escaped string, the escaping of the
: after the protocol is completely bogus, I dunno how it happened but it's
completely wrong. I think this need to be reexamined for all case, 
and escaping should understand URI semantic, 

The escaping is done in xmlCanonicPath - building an uri from
'http://alpha/a b' fails because xmlParseUri expects _escaped_ string and
fails on space after 'a'. Next, all the string is treated as 'path' part of uri:

(uri.c, line 2268):
uri->path = (char *) xmlStrdup((const xmlChar *) path);
...
ret = xmlSaveUri(uri);
...
return(ret);

xmlSaveUri escapes characters that should't be in 'path' segment, including
':' and returns 'http%3A//alpha/a%20b'.

If escaping should be done by library (and not user calling xmlParseFile)
perhaps the easiest way to fix it is to modify xmlCanonicPath/xmlParseUri.
And escaping of already escaped string is not a no-op operation beacuse of
possible recursive escaping of '%' characters.

I also looked at xslt code - in transform.c there's an attempt to build URI
from string and then, when failed, it is repeated with escaped string. Perhaps
the same thing could be done in xmlCanonicPath() ?

P.P>



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