[XML-SIG] Re: value error when parsing XML

Uche Ogbuji uche.ogbuji at fourthought.com
Mon Aug 9 20:44:49 CEST 2004


On Tue, 2004-08-03 at 12:13, Andrew Clover wrote:
> Ajay Brar <abra9823 at mail.usyd.edu.au> wrote:
> 
> > i am using a SAX parser.
> 
> I don't do a lot of SAX, but it looks to me like there's a bug in the 
> xml.sax.saxutils InputSource which is likely to be the cause of your 
> trouble. (Details to follow.)
> 
>  > i think its something to do with the way i call the parser
>  > parser.parse("../um_xml/um_ajay.xml")
> 
> Yes. I would suggest passing in a URI instead:

Precisely.  People too often mix up file names with URIs, and it causes
no end of trouble.

>    filename= '../um_xml/um__ajay.xml'
>    uri= 'file:'+urllib.pathname2url(os.path.abspath(filename))
>    parser.parse(uri)

I think filename should be absolutized before it gets to your "uri="
line.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Decomposition, Process, Recomposition - http://www.xml.com/pub/a/2004/07/28/py-xml.html
Perspective on XML: Steady steps spell success with Google - http://www.adtmag.com/article.asp?id=9663
Managing XML libraries - http://www.adtmag.com/article.asp?id=9160
Commentary on "Objects. Encapsulation. XML?" - http://www.adtmag.com/article.asp?id=9090
Harold's Effective XML - http://www.ibm.com/developerworks/xml/library/x-think25.html
A survey of XML standards - http://www-106.ibm.com/developerworks/xml/library/x-stand4/



More information about the XML-SIG mailing list