[XML-SIG] problems with PyXML 0.6.3

Fred L. Drake, Jr. fdrake@acm.org
Wed, 14 Feb 2001 10:47:21 -0500 (EST)


Alexandre Fayolle writes:
 > Maybe what we need is a new function in os.path or similar that would
 > perform the file -> URL conversion described above. This would ease the
 > work of application writers. I, for one, would be much more at ease if I
 > knew that no implicit assumptions are made on what I pass. If the API
 > requires an URI/URL, then this is what it should get. 

  I started to write a response saying "take a look at
urllib.pathname2url()", but upon thinking more about it and chatting
with Guido on the topic, have concluded that that's not the right
response.  Aside from urllib.pathname2url() being undocumented.  ;)
  What we decided was that while the "XML world" uses URIs for system
identifiers, it still doesn't make a lot of sense for the Python APIs
to hide the distinction between URLs and filenames (and URNs, if
you're using those).  What it comes down to is that there is no way to
ensure proper conversion from a filename to a URL for an arbitrary
system, and the application will generally need to know the difference
anyway.
  There are two places which need to feed data to an XML parser: the
public API which tells it to start parsing, and the internal entity
management.  The later can either be disabled (or non-existant), or
should allow the application to provide an entity manager which can do
whatever makes sense with regard to opening network resources.
  From this, it is reasonable to infer that we should be able to
provide data to the parser by passing it a string and/or a file
object.  Anything which opens a file based on a filename or URL is a
convenience method, and the URL and filename forms should be
distinct.  (And let's face it: while urllib may be a convenient entity
manager, it's not an efficient one!)


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations