[XML-SIG] Re: SAX exceptions are odd

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri, 6 Oct 2000 17:26:38 +0200

> How does it know when I pass it a string and when I pass it a system
> identifier?  In Python, system identifiers are strings?!?  What if I
> have a file called "<foo>" will it open that file or attempt to parse
> it as a string?

If you invoke xml.sax.parse, it will always be understood as a system
identifier - you should invoke parseString if you have a "here"

These are convenience functions - the full API has the notion of
InputSource objects, which are the primary means to tell a parser what
to process. There is some magic telling file names apart from file
objects, but that can't also tell apart system identifiers and here
documents - hence the two functions.

> >How about this:
> >
> >  "Not well-formed in foo.xml at line %d, column %d."
> >
> >If you prefer that I'd be happy to change both that and the lost
> >system identifier (if that is indeed the problem).
> I would like this a lot better.  It will be appreciated by novice
> programmers and whiners like me.

I'd like to caution again: No matter what string is taken now, it will
have to stay forever. Other tools will expect that a certain Python
application formats its XML error messages in a certain way, and they
will whine if that is ever changed.

If that consequence is accepted, then it's fine with me to change that