From stefan_ml at behnel.de Sun Sep 2 18:29:52 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 02 Sep 2007 18:29:52 +0200 Subject: [XML-SIG] lxml 2.0alpha1 released Message-ID: <46DAE500.40408@behnel.de> Hi all, I'm proudly announcing the first alpha release of lxml 2.0. http://codespeak.net/lxml/dev/ http://pypi.python.org/pypi/lxml/2.0alpha1 ** What is lxml? """ In short: lxml is the most feature-rich and easy-to-use library for working with XML and HTML in the Python language. lxml is a Pythonic binding for the libxml2 and libxslt libraries. It is unique in that it combines the speed and feature completeness of these libraries with the simplicity of a native Python API. """ This release features a major cleanup both behind the scenes and at the surface, that improves the XML tool integration and makes the API clearer and more consistent in many places. The major new addition, however, is the lxml.html package, a new toolkit for HTML handling. The web site for the pre-2.0 series is online at http://codespeak.net/lxml/dev/ The "what's new" page has a description of the major changes: http://codespeak.net/lxml/dev/lxml2.html and the ChangeLog has a more detailed list, see below. This being an alpha release means that not everything is stable, both in terms of crashes and the API. There will be a small number of alpha releases to make the advancements publicly available, before the beta releases focus on improving the stability. I warmly invite everyone to contribute to the final release by discussing the API changes and the new features on the mailing list. There is always space for improvements! There is currently a known problem with Microsoft's compilers, so Windows builds may not become available for 2.0alpha1. The next alpha will hopefully come with prebuilt binaries for that platform. Building with the more standards compliant MinGW compilers should work. Note that working on the code now requires Cython (version 0.9.6.5), an enhanced fork of Pyrex. lxml therefore no longer ships with a copy of Pyrex or Cython, but as usual, building from the distribution sources does not require Cython. It can be installed with "easy_install Cython" or from here: http://www.cython.org/ I hope that lxml 2.0 will become a straight continuation of the success story that lxml 1.x was already. Have fun, Stefan 2.0alpha1 (2007-09-02) Features added * Reimplemented objectify.E for better performance and improved integration with objectify. Provides extended type support based on registered PyTypes. * XSLT objects now support deep copying * New makeSubElement() C-API function that allows creating a new subelement straight with text, tail and attributes. * XPath extension functions can now access the current context node (context.context_node) and use a context dictionary (context.eval_context) from the context provided in their first parameter * HTML tag soup parser based on BeautifulSoup in lxml.html.ElementSoup * New module lxml.doctestcompare by Ian Bicking for writing simplified doctests based on XML/HTML output. Use by importing lxml.usedoctest or lxml.html.usedoctest from within a doctest. * New module lxml.cssselect by Ian Bicking for selecting Elements with CSS selectors. * New package lxml.html written by Ian Bicking for advanced HTML treatment. * Namespace class setup is now local to the ElementNamespaceClassLookup instance and no longer global. * Schematron validation (incomplete in libxml2) * Additional stringify argument to objectify.PyType() takes a conversion function to strings to support setting text values from arbitrary types. * Entity support through an Entity factory and element classes. XML parsers now have a resolve_entities keyword argument that can be set to False to keep entities in the document. * column field on error log entries to accompany the line field * Error specific messages in XPath parsing and evaluation NOTE: for evaluation errors, you will now get an XPathEvalError instead of an XPathSyntaxError. To catch both, you can except on XPathError. * The regular expression functions in XPath now support passing a node-set instead of a string * Extended type annotation in objectify: new xsiannotate() function * EXSLT RegExp support in standard XPath (not only XSLT) Bugs fixed * lxml.etree did not check tag/attribute names * The XML parser did not report undefined entities as error * The text in exceptions raised by XML parsers, validators and XPath evaluators now reports the first error that occurred instead of the last * Passing '' as XPath namespace prefix did not raise an error * Thread safety in XPath evaluators Other changes * objectify.PyType for None is now called "NoneType" * el.getiterator() renamed to el.iter(), following ElementTree 1.3 - original name is still available as alias * In the public C-API, findOrBuildNodeNs() was replaced by the more generic findOrBuildNodeNsPrefix * Major refactoring in XPath/XSLT extension function code * Network access in parsers disabled by default From strangest at comcast.net Sun Sep 2 19:00:40 2007 From: strangest at comcast.net (Gloria W) Date: Sun, 02 Sep 2007 13:00:40 -0400 Subject: [XML-SIG] lxml 2.0alpha1 released In-Reply-To: <46DAE500.40408@behnel.de> References: <46DAE500.40408@behnel.de> Message-ID: <46DAEC38.6060900@comcast.net> Stefan, congratulations. This is definitely useful. Please talk a bit about the API, and how it differs/varies from cElementTree, or link to some examples. For example, the node nesting, the usage of a 'tail' for trailing text. I wonder if lxml offers more of a DOM compliant node nesting, or if it conforms to the conventions/oddities of ElemenTree. Also show us how it differs from BeautifulSoup, which has extremely robust unicode handling and mangled XML/HTML tag completion, but may benchmark a bit slower. Thanks again, and good job! Gloria > Hi all, > > I'm proudly announcing the first alpha release of lxml 2.0. > > http://codespeak.net/lxml/dev/ > http://pypi.python.org/pypi/lxml/2.0alpha1 > > ** What is lxml? > > """ > In short: lxml is the most feature-rich and easy-to-use library for working > with XML and HTML in the Python language. > > lxml is a Pythonic binding for the libxml2 and libxslt libraries. It is unique > in that it combines the speed and feature completeness of these libraries with > the simplicity of a native Python API. > """ > > This release features a major cleanup both behind the scenes and at the > surface, that improves the XML tool integration and makes the API clearer and > more consistent in many places. The major new addition, however, is the > lxml.html package, a new toolkit for HTML handling. > > The web site for the pre-2.0 series is online at > > http://codespeak.net/lxml/dev/ > > The "what's new" page has a description of the major changes: > > http://codespeak.net/lxml/dev/lxml2.html > > and the ChangeLog has a more detailed list, see below. > > This being an alpha release means that not everything is stable, both in terms > of crashes and the API. There will be a small number of alpha releases to make > the advancements publicly available, before the beta releases focus on > improving the stability. > > > I warmly invite everyone to contribute to the final release by discussing the > API changes and the new features on the mailing list. There is always space > for improvements! > > > There is currently a known problem with Microsoft's compilers, so Windows > builds may not become available for 2.0alpha1. The next alpha will hopefully > come with prebuilt binaries for that platform. Building with the more > standards compliant MinGW compilers should work. > > Note that working on the code now requires Cython (version 0.9.6.5), an > enhanced fork of Pyrex. lxml therefore no longer ships with a copy of Pyrex > or Cython, but as usual, building from the distribution sources does not > require Cython. It can be installed with "easy_install Cython" or from here: > > http://www.cython.org/ > > I hope that lxml 2.0 will become a straight continuation of the success story > that lxml 1.x was already. > > Have fun, > Stefan > > > 2.0alpha1 (2007-09-02) > Features added > > * Reimplemented objectify.E for better performance and improved > integration with objectify. Provides extended type support based on > registered PyTypes. > * XSLT objects now support deep copying > * New makeSubElement() C-API function that allows creating a new > subelement straight with text, tail and attributes. > * XPath extension functions can now access the current context node > (context.context_node) and use a context dictionary > (context.eval_context) from the context provided in their first > parameter > * HTML tag soup parser based on BeautifulSoup in lxml.html.ElementSoup > * New module lxml.doctestcompare by Ian Bicking for writing simplified > doctests based on XML/HTML output. Use by importing lxml.usedoctest or > lxml.html.usedoctest from within a doctest. > * New module lxml.cssselect by Ian Bicking for selecting Elements with > CSS selectors. > * New package lxml.html written by Ian Bicking for advanced HTML > treatment. > * Namespace class setup is now local to the ElementNamespaceClassLookup > instance and no longer global. > * Schematron validation (incomplete in libxml2) > * Additional stringify argument to objectify.PyType() takes a conversion > function to strings to support setting text values from arbitrary types. > * Entity support through an Entity factory and element classes. XML > parsers now have a resolve_entities keyword argument that can be set to > False to keep entities in the document. > * column field on error log entries to accompany the line field > * Error specific messages in XPath parsing and evaluation > NOTE: for evaluation errors, you will now get an XPathEvalError instead > of an XPathSyntaxError. To catch both, you can except on XPathError. > * The regular expression functions in XPath now support passing a node-set > instead of a string > * Extended type annotation in objectify: new xsiannotate() function > * EXSLT RegExp support in standard XPath (not only XSLT) > > Bugs fixed > > * lxml.etree did not check tag/attribute names > * The XML parser did not report undefined entities as error > * The text in exceptions raised by XML parsers, validators and XPath > evaluators now reports the first error that occurred instead of the last > * Passing '' as XPath namespace prefix did not raise an error > * Thread safety in XPath evaluators > > Other changes > > * objectify.PyType for None is now called "NoneType" > * el.getiterator() renamed to el.iter(), following ElementTree 1.3 - > original name is still available as alias > * In the public C-API, findOrBuildNodeNs() was replaced by the more > generic findOrBuildNodeNsPrefix > * Major refactoring in XPath/XSLT extension function code > * Network access in parsers disabled by default > > > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > > From stefan_ml at behnel.de Mon Sep 3 09:29:43 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Mon, 03 Sep 2007 09:29:43 +0200 Subject: [XML-SIG] lxml 2.0alpha1 released In-Reply-To: <46DAEC38.6060900@comcast.net> References: <46DAE500.40408@behnel.de> <46DAEC38.6060900@comcast.net> Message-ID: <46DBB7E7.1060309@behnel.de> Hi, Gloria W wrote: > Stefan, congratulations. This is definitely useful. Thanks! :) > Please talk a bit about the API, and how it differs/varies from > cElementTree, http://codespeak.net/lxml/dev/compatibility.html > or link to some examples. The docs are full of doctest examples. However, as lxml.html is still pretty new, its docs are not as comprehensive as those for lxml.etree yet. > For example, the node nesting, > the usage of a 'tail' for trailing text. I wonder if lxml offers more of > a DOM compliant node nesting, or if it conforms to the > conventions/oddities of ElemenTree. lxml.etree aims for ElementTree compatibility, so these things work alike. The above link describes the differences that we either cannot work around for technical reasons (or performance reasons) or that are considerate decisions where we think ElementTree is wrong. Note that the ElementTree API is more and more becoming a basis for other APIs in lxml. There is lxml.objectify, which replaces a lot of this API by something that works more like Python objects themselves (a data binding approach). lxml.html extends the API with a bunch of helper methods for link handling and also changes the way the serialisation works to better adapt it to HTML. There's also MathDOM, a MathML implementation, which was the original reason for making lxml extensible at the Element level, back in the days of lxml 0.7. The original idea was actually 'stolen' from Xist, although lxml has definitely found its own way of dealing with it. The one thing I like most about lxml is the tool integration. For example, you can use the Element API in lxml.etree or lxml.objectify or lxml.html, with any of the five path languages: ElementPath, ETXPath, XPath, CSS-Selectors or ObjectPath. I think this is a trend that should continue. Most XML/HTML formats can benefit from specialised Element classes with specially adapted or added methods, properties and even different tree behaviour, while still taking advantage of all the other tools that lxml provides. The possibilities that lxml offers here are close to unlimited (both at the Python level and at the C level) - even with the 'oddities' (as you called it) of ElementTree. I personally believe that .tail attributes are actually a big advantage, as the ignorance of text nodes simplifies the tree model considerably (well, the public one, not necessarily the internal one...) > Also show us how it differs from BeautifulSoup, which has extremely > robust unicode handling and mangled XML/HTML tag completion, but may > benchmark a bit slower. libxml2 does not have as robust support for HTML-like tag soup as BeautifulSoup, but it does a pretty good job anyway. In lxml 2.0, lxml.html comes with BeautifulSoup integration (as ElementTree does), so now you can have both: a tag soup parser and all the features of lxml. Stefan From 2huggie at gmail.com Thu Sep 6 11:42:21 2007 From: 2huggie at gmail.com (Timothy Wu) Date: Thu, 6 Sep 2007 17:42:21 +0800 Subject: [XML-SIG] Unable to run example Message-ID: Hi, I am running example from http://pyxml.sourceforge.net/topics/howto/node12.html and I keep on getting this: Traceback (most recent call last): File "./parser.py", line 37, in ? parser.parse(input) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 103, in parse source = saxutils.prepare_input_source(source) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.py", line 515, in prepare_input_source if source.getByteStream() is None: AttributeError: 'builtin_function_or_method' object has no attribute 'getByteStream' Any hints? Timothy -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20070906/7cede573/attachment.htm From 2huggie at gmail.com Thu Sep 6 13:00:49 2007 From: 2huggie at gmail.com (Timothy Wu) Date: Thu, 6 Sep 2007 19:00:49 +0800 Subject: [XML-SIG] Unable to run example In-Reply-To: References: Message-ID: On 9/6/07, Timothy Wu <2huggie at gmail.com> wrote: > > Hi, > > I am running example from > http://pyxml.sourceforge.net/topics/howto/node12.html and I keep on > getting this: > > Traceback (most recent call last): > File "./parser.py", line 37, in ? > parser.parse(input) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", > line 103, in parse > source = saxutils.prepare_input_source (source) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.py", line > 515, in prepare_input_source > if source.getByteStream() is None: > AttributeError: 'builtin_function_or_method' object has no attribute > 'getByteStream' > > Any hints? > > Timothy Oh how embarrassing. It's just my programming error. Never mind this. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20070906/87bb5111/attachment.htm From jachym.cepicky at gmail.com Wed Sep 12 09:13:32 2007 From: jachym.cepicky at gmail.com (Jachym Cepicky) Date: Wed, 12 Sep 2007 09:13:32 +0200 Subject: [XML-SIG] xsd and python Message-ID: <1189581212.8027.17.camel@mellon> hi, could anybody point me to best documentation resource, where I could learn, how to work with XSD and python? I hope, it would be possible to generate XML based on XSD or maybe some Python code according to to it. I have no clue, whether this is possible or if it is possible in general, but not with python yet. Any related link is welcomed :-) Jachym -- Jachym Cepicky e-mail: jachym.cepicky at gmail.com URL: http://les-ejk.cz GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?= =?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?= =?ISO-8859-1?Q?_zpr=E1vy?= Url : http://mail.python.org/pipermail/xml-sig/attachments/20070912/8816810b/attachment.pgp From ht at inf.ed.ac.uk Wed Sep 12 12:44:38 2007 From: ht at inf.ed.ac.uk (Henry S. Thompson) Date: Wed, 12 Sep 2007 11:44:38 +0100 Subject: [XML-SIG] xsd and python In-Reply-To: <1189581212.8027.17.camel@mellon> (Jachym Cepicky's message of "Wed, 12 Sep 2007 09:13:32 +0200") References: <1189581212.8027.17.camel@mellon> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jachym Cepicky writes: > hi, > could anybody point me to best documentation resource, where I could > learn, how to work with XSD and python? See http://www.ltg.ed.ac.uk/~ht/xsv-status.html ht - -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh Half-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht at inf.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFG58MXkjnJixAXWBoRAjtZAJ0Ru4B608NrM0tTFnXEu6tjY4fsBACdHZva rq/Q2rSe3hRiRsVSRc1tm2w= =SiBo -----END PGP SIGNATURE----- From stefan_ml at behnel.de Wed Sep 12 13:35:37 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 12 Sep 2007 13:35:37 +0200 Subject: [XML-SIG] xsd and python In-Reply-To: <1189581212.8027.17.camel@mellon> References: <1189581212.8027.17.camel@mellon> Message-ID: <46E7CF09.1010402@behnel.de> Jachym Cepicky wrote: > could anybody point me to best documentation resource, where I could > learn, how to work with XSD and python? > > I hope, it would be possible to generate XML based on XSD or maybe some > Python code according to to it. I have no clue, whether this is possible > or if it is possible in general, but not with python yet. I'm not aware of any Python tool that "generates XML based on XSD" (whatever that means), but there are a couple of tools that support validation with XML Schema, such as lxml.etree. http://codespeak.net/lxml/ http://codespeak.net/lxml/validation.html Stefan From stm at dbc.dk Wed Sep 12 14:25:26 2007 From: stm at dbc.dk (Steen Manniche) Date: Wed, 12 Sep 2007 14:25:26 +0200 Subject: [XML-SIG] xsd and python In-Reply-To: <46E7CF09.1010402@behnel.de> References: <1189581212.8027.17.camel@mellon> <46E7CF09.1010402@behnel.de> Message-ID: <200709121425.26391.stm@dbc.dk> Wednesday 12 September 2007 skrev Stefan Behnel: > > Jachym Cepicky wrote: > > could anybody point me to best documentation resource, where I could > > learn, how to work with XSD and python? > > > > I hope, it would be possible to generate XML based on XSD or maybe some > > Python code according to to it. I have no clue, whether this is possible > > or if it is possible in general, but not with python yet. > > I'm not aware of any Python tool that "generates XML based on XSD" (whatever > that means), but there are a couple of tools that support validation with XML > Schema, such as lxml.etree. > > http://codespeak.net/lxml/ > http://codespeak.net/lxml/validation.html > > Stefan > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > > If you by "generate xml from xsd" mean to make an xml instance of an xml schema, then trang[1] does that job. [1]:http://www.thaiopensource.com/relaxng/trang.html, also available through dpkg for debian and ubuntu -- Steen Manniche, Programm?r. Dansk BiblioteksCenter A/S Tempovej 7-11 2750 Ballerup From bortzmeyer at nic.fr Wed Sep 12 14:58:57 2007 From: bortzmeyer at nic.fr (Stephane Bortzmeyer) Date: Wed, 12 Sep 2007 14:58:57 +0200 Subject: [XML-SIG] xsd and python In-Reply-To: <200709121425.26391.stm@dbc.dk> References: <1189581212.8027.17.camel@mellon> <46E7CF09.1010402@behnel.de> <200709121425.26391.stm@dbc.dk> Message-ID: <20070912125857.GA24236@nic.fr> On Wed, Sep 12, 2007 at 02:25:26PM +0200, Steen Manniche wrote a message of 37 lines which said: > If you by "generate xml from xsd" mean to make an xml instance of an > xml schema, then trang[1] does that job. Nothing in the Web page or in the manual suggests that trang has this ability. trang can do the opposite, infer a schema from an instance, like Examplotron does: % cat toto.xml % trang -Ixml -Ornc toto.xml toto.rnc % cat toto.rnc default namespace = "" start = element toto { element foobar { empty } } From jkmacman at yahoo.com Wed Sep 12 15:06:50 2007 From: jkmacman at yahoo.com (Jim Kelly) Date: Wed, 12 Sep 2007 06:06:50 -0700 (PDT) Subject: [XML-SIG] XML-SIG Digest, Vol 53, Issue 5 In-Reply-To: Message-ID: <908263.96943.qm@web50001.mail.re2.yahoo.com> why not xml spy? xml-sig-request at python.org wrote: Send XML-SIG mailing list submissions to xml-sig at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/xml-sig or, via email, send a message with subject or body 'help' to xml-sig-request at python.org You can reach the person managing the list at xml-sig-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of XML-SIG digest..." Today's Topics: 1. xsd and python (Jachym Cepicky) ---------------------------------------------------------------------- Message: 1 Date: Wed, 12 Sep 2007 09:13:32 +0200 From: Jachym Cepicky Subject: [XML-SIG] xsd and python To: xml-sig at python.org Message-ID: <1189581212.8027.17.camel at mellon> Content-Type: text/plain; charset="us-ascii" hi, could anybody point me to best documentation resource, where I could learn, how to work with XSD and python? I hope, it would be possible to generate XML based on XSD or maybe some Python code according to to it. I have no clue, whether this is possible or if it is possible in general, but not with python yet. Any related link is welcomed :-) Jachym -- Jachym Cepicky e-mail: jachym.cepicky at gmail.com URL: http://les-ejk.cz GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?= =?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?= =?ISO-8859-1?Q?_zpr=E1vy?= Url : http://mail.python.org/pipermail/xml-sig/attachments/20070912/8816810b/attachment-0001.pgp End of XML-SIG Digest, Vol 53, Issue 5 ************************************** --------------------------------- Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20070912/51df47d5/attachment.htm From steen at manniche.net Wed Sep 12 19:41:05 2007 From: steen at manniche.net (Steen Manniche) Date: Wed, 12 Sep 2007 19:41:05 +0200 Subject: [XML-SIG] xsd and python In-Reply-To: <20070912125857.GA24236@nic.fr> References: <1189581212.8027.17.camel@mellon> <200709121425.26391.stm@dbc.dk> <20070912125857.GA24236@nic.fr> Message-ID: <200709121941.05905.steen@manniche.net> Wednesday 12 September 2007 skrev Stephane Bortzmeyer: > On Wed, Sep 12, 2007 at 02:25:26PM +0200, > Steen Manniche wrote > a message of 37 lines which said: > > > If you by "generate xml from xsd" mean to make an xml instance of an > > xml schema, then trang[1] does that job. > > Nothing in the Web page or in the manual suggests that trang has this > ability. Yes, I sorry. It is the other way around. Inferring an xml instance from an xml schema is not trivial, since an xml schema can contain infinite paths. And it is not possible to automatically infer this at a unmediated construction of an xml instance. I have not seen any python tools that supports this action. Sorry for the inconvenience and good luck in your search. Regards, Steen > > trang can do the opposite, infer a schema from an instance, like > Examplotron does: > > % cat toto.xml > > > > > % trang -Ixml -Ornc toto.xml toto.rnc > > % cat toto.rnc > default namespace = "" > > start = > element toto { > element foobar { empty } > } > > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > > From dfedoruk at gmail.com Thu Sep 13 16:29:33 2007 From: dfedoruk at gmail.com (Dmitri Fedoruk) Date: Thu, 13 Sep 2007 14:29:33 -0000 Subject: [XML-SIG] lxml + mod_python: cannot unmarshal code objects in restricted execution mode Message-ID: <1189693773.256185.33020@22g2000hsm.googlegroups.com> Hello everyone, I'm developing a mod_python application that is based on XML\XSLT transforming. I used 4Suite libraries for that, but as the speed was unacceptable for me, I switched to lxml. Everything became much easier and 10 times faster, but I've encountered the subject problem. In brief - all my data and xslt are stored and transferred in UTF-8. With 4Suite everything was fine all the time. With lxml it works fine from the console, but inside mod_python it occasionaly dies, ~ one time out of three. Strange - the same code with the same data works or dies by its own means. As far as I have found, there was a similar problem with PyXML and encodings module, but there was no clear solution. So, my configuration is the following: Python 2.5.1 Server version: Apache/2.2.4 (FreeBSD) mod_python-3.3.1 And the relevant parts of my code are these: def extApplyXslt(xslt, data, logger ): try: strXslt = urllib2.urlopen(xslt).read() # i have to read the xslt url to the python string except urllib2.HTTPError, e: ....... except urllib2.URLError, e: ............. try: xslt_parser = etree.XMLParser() xslt_parser.resolvers.add( PrefixResolver("XSLT") ) # and now I have to use the string; a more elegant solution, anyone? f = StringIO(strXslt) xslt_doc = etree.parse(f, xslt_parser) # and here where the problem comes transform = etree.XSLT(xslt_doc) except Exception, exc: logger.log(logging.CRITICAL, exc.__str__() ) try: result_tree = transform(data) return etree.tostring(result_tree, 'utf-8') except Exception, exc: print "xslt processing error!", exc.__str__() return "" It dies with the message 'cannot unmarshal code objects in restricted execution mode'. By profiling I detected the point where problem occurs: transform = etree.XSLT(xslt_doc) So, I would be grateful for any suggestions how to get rid of this. I'd really like to use lxml. Maybe I should initialize the xslt processor in somehow other way? Thanks in advance, Dmitri From bortzmeyer at nic.fr Fri Sep 14 10:35:33 2007 From: bortzmeyer at nic.fr (Stephane Bortzmeyer) Date: Fri, 14 Sep 2007 10:35:33 +0200 Subject: [XML-SIG] xsd and python In-Reply-To: <200709121941.05905.steen@manniche.net> References: <1189581212.8027.17.camel@mellon> <200709121425.26391.stm@dbc.dk> <20070912125857.GA24236@nic.fr> <200709121941.05905.steen@manniche.net> Message-ID: <20070914083533.GA23540@nic.fr> On Wed, Sep 12, 2007 at 07:41:05PM +0200, Steen Manniche wrote a message of 50 lines which said: > Inferring an xml instance from an xml schema is not trivial, since > an xml schema can contain infinite paths. But this is possible. It is not different from generating a program according to a grammar (BNF grammars, like XML schemas, can contain infinite paths) and some programs do it: http://www.quut.com/abnfgen/ http://www.bortzmeyer.org/eusthatius-test-grammars.html So, not trivial but a nice and useful project. Who volunteers? :-) From stefan_ml at behnel.de Sun Sep 16 00:44:40 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 16 Sep 2007 00:44:40 +0200 Subject: [XML-SIG] lxml 2.0alpha2 released Message-ID: <46EC6058.704@behnel.de> Hi all, I just released lxml 2.0alpha2 to PyPI. http://pypi.python.org/pypi/lxml/2.0alpha2 http://codespeak.net/lxml/dev/ ** What is lxml? """ In short: lxml is the most feature-rich and easy-to-use library for working with XML and HTML in the Python language. lxml is a Pythonic binding for the libxml2 and libxslt libraries. It is unique in that it combines the speed and feature completeness of these libraries with the simplicity of a native Python API. """ This release features a number of major API additions that follow the ElementTree library and the future API changes in ElementTree 1.3. The main new features are HTML serialisation support, a feed interface to the parsers, a SAX-like target parser interface, and iterfind() as an iterator version of findall(). All of these are currently more or less experimental, so feedback is warmly welcome. The lxml mailing list is always open for discussion, not only on the new features. The complete changelog is below. Have fun Stefan 2.0alpha2 (2007-09-15) Features added * ET.write(), tostring() and tounicode() now accept a keyword argument "method" that can be one of 'xml' (or None), 'html' or 'text' to serialise as XML, HTML or plain text content. * iterfind() method on Elements returns an iterator equivalent to findall() * itertext() method on Elements * Setting a QName object as value of the .text property or as an attribute will resolve its prefix in the respective context * ElementTree-like parser target interface as described in http://effbot.org/elementtree/elementtree-xmlparser.htm * ElementTree-like feed parser interface on XMLParser and HTMLParser (feed() and close() methods) Bugs fixed * lxml failed to serialise namespace declarations of elements other than the root node of a tree * Race condition in XSLT where the resolver context leaked between concurrent XSLT calls Other changes * element.getiterator() returns a list, use element.iter() to retrieve an iterator (ElementTree 1.3 compatible behaviour) 2.0alpha1 (2007-09-02) Features added * Reimplemented objectify.E for better performance and improved integration with objectify. Provides extended type support based on registered PyTypes. * XSLT objects now support deep copying * New makeSubElement() C-API function that allows creating a new subelement straight with text, tail and attributes. * XPath extension functions can now access the current context node (context.context_node) and use a context dictionary (context.eval_context) from the context provided in their first parameter * HTML tag soup parser based on BeautifulSoup in lxml.html.ElementSoup * New module lxml.doctestcompare by Ian Bicking for writing simplified doctests based on XML/HTML output. Use by importing lxml.usedoctest or lxml.html.usedoctest from within a doctest. * New module lxml.cssselect by Ian Bicking for selecting Elements with CSS selectors. * New package lxml.html written by Ian Bicking for advanced HTML treatment. * Namespace class setup is now local to the ElementNamespaceClassLookup instance and no longer global. * Schematron validation (incomplete in libxml2) * Additional stringify argument to objectify.PyType() takes a conversion function to strings to support setting text values from arbitrary types. * Entity support through an Entity factory and element classes. XML parsers now have a resolve_entities keyword argument that can be set to False to keep entities in the document. * column field on error log entries to accompany the line field * Error specific messages in XPath parsing and evaluation NOTE: for evaluation errors, you will now get an XPathEvalError instead of an XPathSyntaxError. To catch both, you can except on XPathError. * The regular expression functions in XPath now support passing a node-set instead of a string * Extended type annotation in objectify: new xsiannotate() function * EXSLT RegExp support in standard XPath (not only XSLT) Bugs fixed * lxml.etree did not check tag/attribute names * The XML parser did not report undefined entities as error * The text in exceptions raised by XML parsers, validators and XPath evaluators now reports the first error that occurred instead of the last * Passing '' as XPath namespace prefix did not raise an error * Thread safety in XPath evaluators Other changes * objectify.PyType for None is now called "NoneType" * el.getiterator() renamed to el.iter(), following ElementTree 1.3 - original name is still available as alias * In the public C-API, findOrBuildNodeNs() was replaced by the more generic findOrBuildNodeNsPrefix * Major refactoring in XPath/XSLT extension function code * Network access in parsers disabled by default From john.holme at homegain.com Thu Sep 20 01:31:16 2007 From: john.holme at homegain.com (John Holme) Date: Wed, 19 Sep 2007 16:31:16 -0700 Subject: [XML-SIG] which python SOAP framework? Message-ID: <498A25D283DC184C88B42674F85DE4570508EF8A@ex1.homegain.com> I need to pick a SOAP toolkit to use for accessing Google's AdWords API. The Google docs suggest SOAPy, but it seems like there are some more recent entries in the python soap toolkit category. What do the user's of this list suggest? John Holme Software Engineer t 510.420.4315 f 510.655.0848 john.holme at homegain.com 1250 45th Street #200 Emeryville CA 94608 What's Your Home Worth? HomeGain(tm) Connect. Build. Grow. A division of Classified Ventures, LLC -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20070919/915bfd7b/attachment.htm From andrewdied at gmail.com Thu Sep 20 04:53:48 2007 From: andrewdied at gmail.com (Andrew Diederich) Date: Wed, 19 Sep 2007 20:53:48 -0600 Subject: [XML-SIG] which python SOAP framework? In-Reply-To: <498A25D283DC184C88B42674F85DE4570508EF8A@ex1.homegain.com> References: <498A25D283DC184C88B42674F85DE4570508EF8A@ex1.homegain.com> Message-ID: <95b785820709191953w47c8a0e5q510eccd5fcefa831@mail.gmail.com> On 9/19/07, John Holme wrote: > > I need to pick a SOAP toolkit to use for accessing Google's AdWords API. The > Google docs suggest SOAPy, but it seems like there are some more recent > entries in the python soap toolkit category. What do the user's of this list > suggest? SOAPy is unmaintained. ZSI (http://pywebsvcs.sourceforge.net/) is a companion SOAP toolkit which was having a bit of a resurgence six months ago; I don't know the current status. It relied on pyxml, which is completely unmaintained. This made it very hard to use on windows, especially with python 2.5. I think turbo gears has a SOAP piece you can use, but I haven't tried it. -- Andrew Diederich From bortzmeyer at nic.fr Thu Sep 20 09:17:38 2007 From: bortzmeyer at nic.fr (Stephane Bortzmeyer) Date: Thu, 20 Sep 2007 09:17:38 +0200 Subject: [XML-SIG] which python SOAP framework? In-Reply-To: <95b785820709191953w47c8a0e5q510eccd5fcefa831@mail.gmail.com> References: <498A25D283DC184C88B42674F85DE4570508EF8A@ex1.homegain.com> <95b785820709191953w47c8a0e5q510eccd5fcefa831@mail.gmail.com> Message-ID: <20070920071737.GB16541@sources.org> On Wed, Sep 19, 2007 at 08:53:48PM -0600, Andrew Diederich wrote a message of 20 lines which said: > SOAPy is unmaintained. ZSI (http://pywebsvcs.sourceforge.net/) is a > companion SOAP toolkit which was having a bit of a resurgence six > months ago; I don't know the current status. It relied on pyxml, > which is completely unmaintained. At a time (things may have changed), I had a lot of problems with ZSI and SOAPpy worked better, especially for typing. A few notes are: http://www.python.org/about/success/suzanne/ From andrewdied at gmail.com Thu Sep 20 13:46:48 2007 From: andrewdied at gmail.com (Andrew Diederich) Date: Thu, 20 Sep 2007 05:46:48 -0600 Subject: [XML-SIG] which python SOAP framework? In-Reply-To: <20070920071737.GB16541@sources.org> References: <498A25D283DC184C88B42674F85DE4570508EF8A@ex1.homegain.com> <95b785820709191953w47c8a0e5q510eccd5fcefa831@mail.gmail.com> <20070920071737.GB16541@sources.org> Message-ID: <95b785820709200446n5c32fd23k236e003e47bb535@mail.gmail.com> On 9/20/07, Stephane Bortzmeyer wrote: > At a time (things may have changed), I had a lot of problems with ZSI > and SOAPpy worked better, especially for typing. > > A few notes are: > > http://www.python.org/about/success/suzanne/ SOAPpy was a bit easier to use. I can't remember specifically what pushed me from SOAPpy to ZSI -- it may have just been the maintenance piece. I had been trying to do SOAP over XMPP, and both libraries were very tied to HTTP. Another issue is both do not follow the latest SOAP specs, so if you are trying to integrate with SOAP web services written in java or .NET, you are likely to run into problems because they'll speak 1.2, and you'll be on 1.1, etc. The whole thing soured me on SOAP, really. SOAP is very complicated, keeps changing incompatibly, and doesn't work well with python. -- Andrew Diederich From prajwala.manchikatla at azri.biz Thu Sep 20 14:18:28 2007 From: prajwala.manchikatla at azri.biz (prajwala.manchikatla at azri.biz) Date: Thu, 20 Sep 2007 14:18:28 +0200 (CEST) Subject: [XML-SIG] xml to word document conversion Message-ID: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> Hi, I want to convert xml file to a word document using python. Is there any built in module available? or Is there any other way to convert xml file to word document. Please suggest me. This is very urgent now. Thanks, prajwala From strangest at comcast.net Thu Sep 20 17:11:20 2007 From: strangest at comcast.net (Gloria W) Date: Thu, 20 Sep 2007 11:11:20 -0400 Subject: [XML-SIG] xml to word document conversion In-Reply-To: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> References: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> Message-ID: <46F28D98.9000609@comcast.net> I recommend you read this forum thread: http://www.oooforum.org/forum/viewtopic.phtml?t=3451 and try OpenOffice CLI or Python API. ~G~ > Hi, > > I want to convert xml file to a word document using python. Is there > any built in module available? > or Is there any other way to convert xml file to word document. > Please suggest me. This is very urgent now. > > Thanks, > prajwala > > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > > From lance.ellinghaus at eds.com Thu Sep 20 17:05:41 2007 From: lance.ellinghaus at eds.com (Ellinghaus, Lance) Date: Thu, 20 Sep 2007 11:05:41 -0400 Subject: [XML-SIG] xml to word document conversion In-Reply-To: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> References: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> Message-ID: <752A61D5C34D41478E638FC92AF9051B016FE4D2@usahm207.amer.corp.eds.com> You would have to create a converter yourself. Look for WordSheetML specifications on the Microsoft website. There is also a SpreadSheetML for creating spreadsheets (working on a Python module for this). If anyone knows of any existing modules, please let me know. Lance Lance Ellinghaus EDS Federal Reserve Bank & U.S. Treasury ---------------------------------------- Cell Phone: 972-877-0409 mailto:lance.ellinghaus at eds.com -----Original Message----- From: xml-sig-bounces at python.org [mailto:xml-sig-bounces at python.org] On Behalf Of prajwala.manchikatla at azri.biz Sent: Thursday, September 20, 2007 8:18 AM To: xml-sig at python.org Subject: [XML-SIG] xml to word document conversion Hi, I want to convert xml file to a word document using python. Is there any built in module available? or Is there any other way to convert xml file to word document. Please suggest me. This is very urgent now. Thanks, prajwala _______________________________________________ XML-SIG maillist - XML-SIG at python.org http://mail.python.org/mailman/listinfo/xml-sig From prajwala.manchikatla at azri.biz Fri Sep 21 07:30:41 2007 From: prajwala.manchikatla at azri.biz (prajwala.manchikatla at azri.biz) Date: Fri, 21 Sep 2007 07:30:41 +0200 (CEST) Subject: [XML-SIG] [Fwd: Re: xml to word document conversion] Message-ID: <51104.202.53.13.106.1190352641.squirrel@mail.azri.biz> ---------------------------- Original Message ---------------------------- Subject: Re: [XML-SIG] xml to word document conversion From: prajwala.manchikatla at azri.biz Date: Fri, September 21, 2007 7:28 am To: "Ellinghaus, Lance" -------------------------------------------------------------------------- Thanks for your reply. I found some clue in the below link. http://www.windowsdevcenter.com/pub/a/windows/2004/09/07/XMLnword2003.html?page=1 That article in that link is using xslt to convert normal xml to wordprocessingML which is used by ms word 2003 and above. I tested that example and it is working well. But there is some problem, the out put file is again an xml. If i open that xml file in the ms word 2003 it is opening as document. But when i rename it as .doc and open in the word , it is showing that xml code. I want the extension should be doc so that can open that file directly using ms word. In the current case if it is xml file no one will open that in word and the default option of xml editor will be shown there. can any one try to solve. > You would have to create a converter yourself. > Look for WordSheetML specifications on the Microsoft website. > > There is also a SpreadSheetML for creating spreadsheets (working on a Python module for this). > > If anyone knows of any existing modules, please let me know. > > Lance > > > Lance Ellinghaus > EDS > Federal Reserve Bank & U.S. Treasury > ---------------------------------------- > Cell Phone: 972-877-0409 > mailto:lance.ellinghaus at eds.com > > > -----Original Message----- > From: xml-sig-bounces at python.org [mailto:xml-sig-bounces at python.org] On Behalf Of prajwala.manchikatla at azri.biz > Sent: Thursday, September 20, 2007 8:18 AM > To: xml-sig at python.org > Subject: [XML-SIG] xml to word document conversion > > Hi, > > I want to convert xml file to a word document using python. Is there > any built in module available? > or Is there any other way to convert xml file to word document. > Please suggest me. This is very urgent now. > > Thanks, > prajwala > > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > From stefan_ml at behnel.de Fri Sep 21 07:38:56 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 21 Sep 2007 07:38:56 +0200 Subject: [XML-SIG] [Fwd: Re: xml to word document conversion] In-Reply-To: <51104.202.53.13.106.1190352641.squirrel@mail.azri.biz> References: <51104.202.53.13.106.1190352641.squirrel@mail.azri.biz> Message-ID: <46F358F0.3030809@behnel.de> prajwala.manchikatla at azri.biz wrote: > I found some clue in the below link. > > http://www.windowsdevcenter.com/pub/a/windows/2004/09/07/XMLnword2003.html?page=1 > > That article in that link is using xslt to convert normal xml to > wordprocessingML which is used by ms word 2003 and above. > I tested that example and it is working well. > But there is some problem, the out put file is again an xml. > If i open that xml file in the ms word 2003 it is opening as document. But > when i rename it as .doc and open in the word , it is showing that xml > code. I want the extension should be doc so that can open that file > directly using ms word. In the current case if it is xml file no one will > open that in word and the default option of xml editor will be shown > there. What you are trying to solve is a Microsoft problem, not an XML problem (wrong list). You can try to pipe the result through MS Word after creating it, e.g. using win32com (never used it myself). Stefan From prajwala.manchikatla at azri.biz Fri Sep 21 11:32:47 2007 From: prajwala.manchikatla at azri.biz (prajwala.manchikatla at azri.biz) Date: Fri, 21 Sep 2007 11:32:47 +0200 (CEST) Subject: [XML-SIG] xml to word document conversion In-Reply-To: <46F28D98.9000609@comcast.net> References: <39070.202.53.13.106.1190290708.squirrel@mail.azri.biz> <46F28D98.9000609@comcast.net> Message-ID: <51120.202.53.13.106.1190367167.squirrel@mail.azri.biz> thanks for ur help. I searched for openOffice CLI then i found an article http://www.xml.com/pub/a/2006/01/11/from-microsoft-to-openoffice.html?page=1 Here it is specified how to execute open office macro from command prompt by saving the file as PDF, OOO etc.. I used that to convert wordprocessingML file to doc file. so finally am able to convert xml file to doc file in 2 steps 1. by using xslt i converted xml to wordprocessingML 2. by using open office converted wordprocessingML to doc. > I recommend you read this forum thread: > http://www.oooforum.org/forum/viewtopic.phtml?t=3451 > and try OpenOffice CLI or Python API. > ~G~ >> Hi, >> >> I want to convert xml file to a word document using python. Is there >> any built in module available? >> or Is there any other way to convert xml file to word document. >> Please suggest me. This is very urgent now. >> >> Thanks, >> prajwala >> >> _______________________________________________ >> XML-SIG maillist - XML-SIG at python.org >> http://mail.python.org/mailman/listinfo/xml-sig >> >> > > From lance.ellinghaus at eds.com Fri Sep 21 21:19:11 2007 From: lance.ellinghaus at eds.com (Ellinghaus, Lance) Date: Fri, 21 Sep 2007 15:19:11 -0400 Subject: [XML-SIG] [Fwd: Re: xml to word document conversion] In-Reply-To: <46F358F0.3030809@behnel.de> References: <51104.202.53.13.106.1190352641.squirrel@mail.azri.biz> <46F358F0.3030809@behnel.de> Message-ID: <752A61D5C34D41478E638FC92AF9051B0174B518@usahm207.amer.corp.eds.com> There is a XML comment tag that needs to be at the beginning of the file... Excel files begin with: Word files begin with: The mso-application comment is what tells Explorer and MS Word to use it as a Word document. Leave the extension as .xml Lance -----Original Message----- From: xml-sig-bounces at python.org [mailto:xml-sig-bounces at python.org] On Behalf Of Stefan Behnel Sent: Friday, September 21, 2007 1:39 AM To: prajwala.manchikatla at azri.biz Cc: xml-sig at python.org Subject: Re: [XML-SIG] [Fwd: Re: xml to word document conversion] prajwala.manchikatla at azri.biz wrote: > I found some clue in the below link. > > http://www.windowsdevcenter.com/pub/a/windows/2004/09/07/XMLnword2003. > html?page=1 > > That article in that link is using xslt to convert normal xml to > wordprocessingML which is used by ms word 2003 and above. > I tested that example and it is working well. > But there is some problem, the out put file is again an xml. > If i open that xml file in the ms word 2003 it is opening as document. > But when i rename it as .doc and open in the word , it is showing that > xml code. I want the extension should be doc so that can open that > file directly using ms word. In the current case if it is xml file no > one will open that in word and the default option of xml editor will > be shown there. What you are trying to solve is a Microsoft problem, not an XML problem (wrong list). You can try to pipe the result through MS Word after creating it, e.g. using win32com (never used it myself). Stefan _______________________________________________ XML-SIG maillist - XML-SIG at python.org http://mail.python.org/mailman/listinfo/xml-sig From tom.kalmijn at warpgear.com Thu Sep 20 15:56:38 2007 From: tom.kalmijn at warpgear.com (Tom Kalmijn) Date: Thu, 20 Sep 2007 13:56:38 -0000 Subject: [XML-SIG] XBEL XSD Message-ID: <7A83837DAFF2415FB16591938F20AA3B@Gandalf> Hi there, I'd like to know if you have the XBEL DTD available as an XSD? I am the author of a program named Favorez (listed on your site). I am thinking of making a XBEL aware webservice and my tools can handle XSDs more easily (compared to DTDs). Of course I can run it through some conversion tool, but wanted to check with you first. Looking forward to your response. kind regards, Tom Tom Kalmijn WarpGear Software The Netherlands