[Zope] how to read xml file in a python script

J. Cameron Cooper jccooper at jcameroncooper.com
Wed Nov 5 15:26:44 EST 2003


> And so I am afraid I am still stick with my original problem:
> I have an xml document under zope and I would like to parse it and 
> extract
> its content with a python script. I would like to do this under the 
> context of
> zope.

You've heard about the restrictions on TTW code. Use an external method. 
Or...

There are Zope products to help with this. There is/used to be a 
ParsedXML product and several others to make XML available looking like 
Zope objects or in some other reasonable way.

If you want to do straight Python, there's SAX 
[http://www.saxproject.org/] and DOM parsers. Both are pretty easy, but 
it depends on what you want to do which to use. E.g. for absolute 
simplicity of implementation, Python's MiniDOM can't be beat. For large 
datasets, you'll want to go with SAX.

          --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list