[IronPython] pyexpat for IronPython

Seo Sanghyeon tinuviel at sparcs.kaist.ac.kr
Wed Nov 16 13:00:29 CET 2005


pyexpat is a built-in XML parser for CPython. As this is not available
from IronPython, I wrote a wrapper around System.Xml.XmlTextReader to
fake the interface.

http://sparcs.kaist.ac.kr/~tinuviel/devel/fepy/pyexpat.py

With this, an example from the Python Library Reference runs correctly:
http://docs.python.org/lib/module-xml.parsers.expat.html

My main interest is to use this with ElementTree, a very nice API to
deal with XML:
http://effbot.org/zone/element-index.htm

The most basic ElementTree operations already work correctly. Caveats:

1. repr() on ElementTree objects fail because %x formatting is not
implemented yet.

2. Just unzipping ElementTree distribution and importing doesn't work.
Copy ElementTree.py, and ElementTree.py only, to somewhere in sys.path.
This is because ElementTree optionally imports ElementPath when present,
but ElementPath uses re.findall which is not implemented yet.

I am not experienced with .NET at all, and this is my first programming
in IronPython apart from toying. Comments welcome!

Seo Sanghyeon



More information about the Ironpython-users mailing list