xml.sax.XMLReader and document encodings

Jp Calderone exarkun at intarweb.us
Tue Mar 4 01:33:48 CET 2003


  I'm parsing an XML document (an RDF), with code along these lines:

    import xml.sax
    class ProjectContentHandler(xml.sax.ContentHandler):
        # Various things

    h = ProjectContentHandler()
    p = xml.sax.make_parser()
    p.setContentHandler(h)  
    f = file('projects.rdf', 'r')
    p.parse(f)

  I am interested in the encoding of the document, though.  I can't seem to
find the API which provides this functionality.  Does anyone know?


  Thanks in advance,

  Jp

-- 
"There is no reason for any individual to have a computer in their
home."
                -- Ken Olson, President of DEC, World Future Society
                   Convention, 1977
-- 
 up 15:58, 8 users, load average: 0.05, 0.15, 0.25





More information about the Python-list mailing list