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

Dennis Allison allison at sumeru.stanford.EDU
Wed Nov 5 12:16:14 EST 2003


Python scripts in Zope are restricted for security reasons.  You'll need
to do your XML processing using External Methods (python scripts, but not
subject to the same security restrictions) or Products (python extensions 
to Zope).  When you set up the Python XML tools, remember to install them 
into the Python you use to run Zope, not elsewhere.  You may want to
consider using the PyRXP parser from ReportLabs which is fast, stable, and 
very python friendly.

On Wed, 5 Nov 2003, vupt vupt wrote:

> Hi Andreas,
> 
> Thanks for replying to me.
> 
> I checked out the python documentation and I followed up
> with this good hands on article about parsing XML in Python
> (http://www.devarticles.com/art/1/383/3)
> 
> In the article, they mention one way to parse xml using
> the sax parser by importing this module:
> from xml.sax import make_parser
> 
> and using this command:
> parser.parse(open('playerStats.xml'))
> 
> But when I try to do this in my zope python script, I get
> Error Value: import of "xml.sax" is unauthorized
> 
> Also I read that the open command is not allowed in zope.
> 
> 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.
> 
> I know there is lots of documentation on how to use xml under python.
> But how do I use read xml under zope? Is it different?
> 
> 
> Thanks again for any input
> 
> pvu
> 
> 
> >From: Andreas Jung <lists at andreas-jung.com>
> >Reply-To: Andreas Jung <lists at andreas-jung.com>
> >To: vupt vupt <vuptme at hotmail.com>, zope at zope.org
> >Subject: Re: [Zope] how to read xml file in a python script
> >Date: Wed, 05 Nov 2003 14:32:19 +0100
> >
> >Read the Python Library Reference. THere is enough documentation on 
> >Python+XML.
> >
> >-aj
> >
> >--On Mittwoch, 5. November 2003 13:26 Uhr +0000 vupt vupt 
> ><vuptme at hotmail.com> wrote:
> >
> >>Hi,
> >>
> >>I am new to Zope and hope someone can help me with an
> >>xml task.
> >>
> >>I have created an Xml file using the XMLKit product.
> >>Now I would like to create a python script to parse
> >>the XML file to get information from it. How do I do
> >>this?
> >>
> >>If someone can point me to some examples or give some
> >>examples of how to do this, I would very appreciate
> >>it.
> >>
> >>thanks in advance.
> >>
> >>pvu
> >>
> >>_________________________________________________________________
> >>The new MSN 8: smart spam protection and 2 months FREE*
> >>http://join.msn.com/?page=features/junkmail
> >>http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.
> >>msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
> >>
> >>
> >>_______________________________________________
> >>Zope maillist  -  Zope at zope.org
> >>http://mail.zope.org/mailman/listinfo/zope
> >>**   No cross posts or HTML encoding!  **
> >>(Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
> >>  http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> >
> >
> >
> 
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.  
> http://join.msn.com/?page=dept/features&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 




More information about the Zope mailing list