XML file parsing with SAX

Uche Ogbuji uche.ogbuji at gmail.com
Sat Apr 23 16:54:55 EDT 2005


On 4/23/05, Willem Ligtenberg <wligtenberg at gmail.com> wrote:
> so that will be sax.handler.feature_external_ges = "false"

Yes.

> And it will work?

Honestly, I'm not sure.  It should, but I've found these edge cases a
bit hard to predict in  the Python built-in libs :-(

> But what about using a catalog? I am very new to python and XML...

Catalogs allow you to rewrite the IDs for entities and such.  So if
you had an XML file with an entity at a URL, but you were working
offline, you could use a catalog to "redirect" the entity to a copy on
your local filesystem.

Problem, now that I think of it, is that I'm not sure you can specify
an catalog in PySAX.  You might instead have to override the method
entityResolver in your handler (and be sure to ).  See the example in
listing 1 and and discussion here:

http://www.xml.com/pub/a/2005/03/02/pyxml.html

Good luck.

-- 
Uche Ogbuji                               Fourthought, Inc.
http://uche.ogbuji.net                    http://fourthought.com
http://copia.ogbuji.net                   http://4Suite.org
Use CSS to display XML, part 2 -
http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html
XML Output with 4Suite & Amara -
http://www.xml.com/pub/a/2005/04/20/py-xml.htmlUse XSLT to prepare XML
for import into OpenOffice Calc -
http://www.ibm.com/developerworks/xml/library/x-oocalc/
Schema standardization for top-down semantic transparency -
http://www-128.ibm.com/developerworks/xml/library/x-think31.html



More information about the Python-list mailing list