Re: [Zope] Parse a XML file in Zope, zopeXMLmethods Product not working in Zope 2.8.1

2005-09-26 Thread Dieter Maurer
Martin Koekenberg wrote at 2005-9-26 15:57 +0200:
> ...
>Does annyone knows a Product of method to parse xml in Zope without the 
>zopeXMLmethods product ?

You can use any of the methods for XML parsing supported by Python, among
others

  *  MiniDOM

  *  "[c]ElementTree"

  *  SAX

  *  "pyexpat"

  *  "sgmlop"

  *  "libxml2"


Note that the listed options operate on different API levels (DOM, SAX,
raw parsing events).


-- 
Dieter
___
Zope maillist  -  Zope@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 )


Re: [Zope] Parse a XML file in Zope, zopeXMLmethods Product not working in Zope 2.8.1

2005-09-26 Thread Sascha Ottolski
Am Montag, 26. September 2005 15:57 schrieb Martin Koekenberg:
> Hello,
>
> I've a xml file on the file system (the source is on an other webserver and
> the download is scheduled). How ca I parse this file with a xslt in Zope.
> ZopeXMLmethods isn't working annymore in Zope 2.8.1.
>
> Does annyone knows a Product of method to parse xml in Zope without the
> zopeXMLmethods product ?
>
> Regards,
>
> Martin Koekenberg

I do it like this (ExternalMethod in this case):


import libxml2
import libxslt

stylestring = file("/path/to/style/file.xsl").read()

def xslt(data):
# note: if styledoc and style are defined outside the function,
# zope dumps core :-(
styledoc = libxml2.parseDoc(stylestring)
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.parseDoc(data)
result = style.applyStylesheet(doc, None)
html = style.saveResultToString(result)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
return html



may be not very smart, but it's working :-)


Cheers, 

Sascha
___
Zope maillist  -  Zope@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 )


Re: [Zope] Parse a XML file in Zope, zopeXMLmethods Product not working in Zope 2.8.1

2005-09-26 Thread Garito

Martin Koekenberg escribió:


Hello,
 
I've a xml file on the file system (the source is on an other 
webserver and the download is scheduled). How ca I parse this file 
with a xslt in Zope.  ZopeXMLmethods isn't working annymore in Zope 2.8.1.
 
Does annyone knows a Product of method to parse xml in Zope without 
the zopeXMLmethods product ?
 
Regards,
 
Martin Koekenberg




___
Zope maillist  -  Zope@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 )
 


Hi!
I use xml.dom.minidom
Alternatives?

Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito/


___
Zope maillist  -  Zope@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 )