[XML-SIG] Using PyExpat.py

Fredrik Lundh fredrik@effbot.org
Tue, 20 Feb 2001 00:38:04 +0100

Uche Ogbuji wrote:
> > > I can't find out whether this has been settled. Did you propose to
> > > drop the support for URLs in the API, or the one for local files.
> > 
> > I'd like to drop support for URLs; I don't think the typical computer
> > is sufficiently networked to make this work well.
> In this case, the typical computer user will have a great deal of trouble 
> using any XML application in any language.  Almost all of them use URIs as 
> basis, and for good reason.  Special support for local files are almost 
> universally a mere convenience.
> Most XML processing specifications mandate that the URI of the XML entity that 
> contains an infoset node is used as the basis for further processing.  To me, 
> this argues strongly for dropping local files rather than URIs if we must 
> choose.  Some XML specs would be very difficult to implement properly if the 
> low-level tools became file-system-only readers.

is the code Guido quoted taken from a utility function (e.g. a standard
input handler), or is it part of the core library:

        if os.path.isfile(sysid):
            basehead = os.path.split(os.path.normpath(base))[0]
            source.setSystemId(os.path.join(basehead, sysid))
            f = open(sysid, "rb")
            source.setSystemId(urlparse.urljoin(base, sysid))
            f = urllib.urlopen(source.getSystemId())

if the latter, I hope you realize that this can be abused in all sorts of
interesting ways...

Cheers /F