Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17161

Re: Fixing the XML batteries

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; '(especially': 0.07; 'migration': 0.07; 'postpone': 0.07; 'python': 0.08; 'scripts': 0.09; 'encoding.': 0.09; 'optionally': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'anyway': 0.09; '2.7': 0.13; 'cet': 0.16; 'elements).': 0.16; 'subject:XML': 0.16; 'suffix': 0.16; '3.2': 0.18; 'simpler': 0.18; '(which': 0.19; "haven't": 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'versions': 0.23; 'appear': 0.23; 'interface': 0.23; 'documented': 0.23; 'though.': 0.23; 'fine': 0.24; 'stefan': 0.24; 'module': 0.26; 'function': 0.27; 'import': 0.27; 'pass': 0.29; '2.3': 0.29; 'matches': 0.29; 'looks': 0.29; 'class': 0.29; 'seem': 0.30; 'can.': 0.30; 'dom': 0.30; 'for,': 0.30; 'received:159': 0.30; 'separately': 0.30; 'xml': 0.31; 'version': 0.32; 'quite': 0.32; 'earlier': 0.32; 'typically': 0.32; 'implement': 0.32; "won't": 0.33; 'header:User-Agent:1': 0.33; 'actually': 0.33; 'header:X-Complaints-To:1': 0.33; 'instead': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'too': 0.34; '2.4': 0.34; 'languages.': 0.34; 'thank': 0.35; 'however,': 0.36; 'example,': 0.37; '8bit%:86': 0.37; 'convenient': 0.37; 'depend': 0.37; 'element': 0.37; 'using': 0.38; 'stable': 0.38; 'received:org': 0.38; 'some': 0.38; 'should': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; 'worth': 0.61; 'your': 0.61; 'full': 0.62; 'you.': 0.63; 'here.': 0.66; 'respect.': 0.67; 'glad': 0.68; 'soon': 0.70; 'suited': 0.73; 'skip:\xd0 20': 0.77; 'et,': 0.84; 'standard,': 0.84; 'releases.': 0.91; 'old.': 0.97
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: Fixing the XML batteries
Date Tue, 13 Dec 2011 20:57:40 +0200
References <jbsfar$en7$1@dough.gmane.org> <CAKmKYaBid4c8Y0pe7txxZMk9+0WN8Hr5ZodS=HP05MdV-ysPhQ@mail.gmail.com> <4EE7425A.2090006@gmail.com> <jc7glm$j62$1@dough.gmane.org> <jc7ndj$5rn$1@dough.gmane.org> <jc7p99$k77$1@dough.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 159.146.158.25
User-Agent Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111110 Thunderbird/8.0
In-Reply-To <jc7p99$k77$1@dough.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3612.1323802687.27778.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323802687 news.xs4all.nl 6932 [2001:888:2000:d::a6]:38180
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17161

Show key headers only | View raw


13.12.11 16:59, Stefan Behnel написав(ла):
> It matches my opinion though.

I would be glad to divide your intentions, however ElementTree looks 
less documented than minidom, and is not full replacement. For example, 
I haven't found how to get XML encoding. Also, at use of ElementTree 
instead of minidom the suffix "ns0:" is added to each element. I do not 
see how to _create_ a new element and to write it with <?xml ...?> header.

And DOM interface is more habitual for those who works with some other 
languages.

> Yes, that's what C14N is there for, typically used for cryptography,
> hashing, etc. However, MiniDOM doesn't implement that standard, so
> you're on your own here.

MiniDOM quite suited me earlier in this respect. I will pass to C14N as 
soon as I will be can.

> The ET module is actually quite short (<1700 lines), so you can just
> copy the Py2.7 version into your sources and optionally import it on
> older Python releases. Since you only seem to depend on the serialiser
> (which is worth using anyway because it is much faster in the Py2.7
> version), older platform versions of cET should also work just fine with
> that module copy, so you can basically just import everything from
> xml.etree.cElementTree and use the ElementTree class and the tostring()
> function from your own local version if the platform version is too old.
>
> Note that ET is also still available as a separately installable
> package, may or may not be simpler to use for you.

I thank, it is too bulky for my small scripts (which I have decided to 
update from Python 2.3 or 2.4 to modern Python 3 and 2.6+). I will 
better postpone high-grade migration for half-year or year while the 
Python 2.7 and 3.2 won't appear in stable versions of popular distributives.

I thank you for ET, it really is more convenient at some applications 
(especially at work with the text in elements).

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fixing the XML batteries Serhiy Storchaka <storchaka@gmail.com> - 2011-12-13 20:57 +0200

csiph-web