[XML-SIG] prepare_input_source and relative path

Sylvain Thénault Sylvain.Thenault at logilab.fr
Tue Feb 8 16:42:10 CET 2005


On Tuesday 08 February à 04:13, Mike Brown wrote:
> Sylvain Thénault wrote:
> > - prepare_input_source('relative.xml', '/base') -> /base/relative.xml
> >   the sf submitted patch fix this one to.
> 
> Under no circumstances should '/base' + 'relative.xml' == '/base/relative.xml'.
> It would only be an acceptable result if you had '/base/' instead of '/base'.
> 
> 
> > - prepare_input_source('file:relative.xml', '/base') ->
> >   file:/base/relative.xml
> 
> Same here. This is incorrect.
 
yes, sorry for the wrong examples. Anyway in pyxml the base argument is
usually something like '/base/starthere.xml' so the patch fix correctly
this case. However you're right that it should probably be fixed to
handle the "no trailing slash" problem.
 
> > this allow to have a xml file containing relative system identifiers
> > such as:
> > 
> >   <!ENTITY  plans SYSTEM "file:plans.xml">
> 
> (1) 'file:plans.xml' is not a relative URI reference.
> 
> (2) The result of merging the reference 'file:plans.xml' with *any* base URI
>     must be 'file:plans.xml'.  RFC 3986 sec. 5 governs this resolution.
> 
> >   <!ENTITY  chatbot SYSTEM "chatbot.xml">
> > 
> > where parse(open('path to my xml file')) should not fail as it currently
> > does.
> 
> Trust me, you'll find that it is much easier to implement RFC 3986 sec. 5 than 
> it is to work around bugs in urllib and urlparse. I suggest porting Absolutize()
> and BaseJoin() from 4Suite's Ft.Lib.Uri.
 
I guess you're right. I wrote this patch because it was fixing my
problem. Now if it doesn't take too much time to have every cases
correctly fixed by implementing RFC 3986, I may take some time to do so
or to help having it done. And if parts of the job is already done in
4suite, that's great. However what's in 4suite, what's not and need to
be implemented is not yet clear to me.

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org



More information about the XML-SIG mailing list