[XML-SIG] prepare_input_source and relative path

Mike Brown mike at skew.org
Tue Feb 8 12:13:01 CET 2005

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.

> 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.


More information about the XML-SIG mailing list