[XML-SIG] prepare_input_source and relative path

Uche Ogbuji Uche.Ogbuji at fourthought.com
Mon Feb 7 18:04:34 CET 2005

On Mon, 2005-02-07 at 12:18 +0100, Sylvain Thénault wrote:
> Hey,
> I've been heating a bug which is already registered as #616431 in the
> bug tracker. I find it very annoying and I've patched the function to
> make it work before noticing a patch was already available. Is there any
> reason to still wait to apply it ?
> Anyway I've joined to this mail my version of the fix, which fix the
> following cases:
> - prepare_input_source('relative.xml', '/base') -> /base/relative.xml
>   the sf submitted patch fix this one to.
> - prepare_input_source('file:relative.xml', '/base') ->
>   file:/base/relative.xml
> this allow to have a xml file containing relative system identifiers
> such as:
>   <!ENTITY  plans SYSTEM "file:plans.xml">
>   <!ENTITY  chatbot SYSTEM "chatbot.xml">
> where parse(open('path to my xml file')) should not fail as it currently
> does.
> If this patch sounds good to you, I can check it in.

Wow.  I'm always amazed at some of bugs that have lived on for so long
in PyXML.

Your patch seems fine to me, but there is one area that is probably
worth discussion.  I hope Mike Brown has a moment to chip in because
he's an expert at such matters.

For the case of the file: URL scheme (BTW, you might want to consider
replacing your variable name "proto" with "scheme"), it's probably OK to

file:///base + file:relative.xml -> file:///base/relative.xml

Since the file scheme's semantics are so wooly.  But this wouldn't make
sense if you replaced "file" with "http".

Then there's the matter of a base URI given as 


in 4Suite we require all base URIs to be proper base URIs (so they must
at least have a scheme).  I think this is a reasonable restriction based
on RFC requirements.  Is there a valid user case where there would not
be a proper base URI, anyway?

Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Introducing the Amara XML Toolkit - http://www.xml.com/pub/a/2005/01/19/amara.html
Be humble, not imperial (in design) - http://www.adtmag.com/article.asp?id=10286
Querying WordNet as XML - http://www.ibm.com/developerworks/xml/library/x-think29.html
Manage XML collections with XAPI - http://www-106.ibm.com/developerworks/xml/library/x-xapi.html
Default and error handling in XSLT lookup tables - http://www.ibm.com/developerworks/xml/library/x-tiplook.html
Packaging XSLT lookup tables as EXSLT functions - http://www.ibm.com/developerworks/xml/library/x-tiplook2.html

More information about the XML-SIG mailing list