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


Groups > comp.lang.python > #110448

Re: Which one is the best XML-parser?

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From dieter <dieter@handshake.de>
Newsgroups comp.lang.python
Subject Re: Which one is the best XML-parser?
Date Fri, 24 Jun 2016 08:39:47 +0200
Lines 35
Message-ID <mailman.90.1466750406.11516.python-list@python.org> (permalink)
References <1312978293.949108.1466715441953.JavaMail.yahoo.ref@mail.yahoo.com> <1312978293.949108.1466715441953.JavaMail.yahoo@mail.yahoo.com> <87r3bnrsy4.fsf@handshake.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.uni-berlin.de wZYL425C36sfXRR41Zm4FgqNCEsmwQFJdnQW9CPB6b/g==
Cancel-Lock sha1:oKg+160gxBvyOECN8w8yYugA7Ck=
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.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'means,': 0.07; 'processing.': 0.07; 'parsers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'size,': 0.13; 'parser.': 0.16; 'personally,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'structure.': 0.16; 'subject:XML': 0.16; 'subject:parser': 0.16; 'transform': 0.18; '(in': 0.18; 'parse': 0.22; 'parser': 0.22; 'python"': 0.22; 'absolute': 0.23; 'examples': 0.24; 'xml': 0.24; 'install': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'external': 0.27; 'typically': 0.29; 'usually': 0.33; 'structure': 0.34; 'handle': 0.34; 'besides': 0.35; 'tasks': 0.35; 'supports': 0.35; 'but': 0.36; 'there': 0.36; 'tool': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'data': 0.39; 'subject:the': 0.39; 'subject:-': 0.39; 'rather': 0.39; 'skip:x 10': 0.40; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'called': 0.40; 'term': 0.60; 'your': 0.60; 'documents': 0.61; 'skip:n 10': 0.62; 'more': 0.63; 'complete': 0.63; 'binding': 0.66; 'features:': 0.66; 'python-list': 0.66; 'verification': 0.72
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57b38942.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <87r3bnrsy4.fsf@handshake.de>
X-Mailman-Original-References <1312978293.949108.1466715441953.JavaMail.yahoo.ref@mail.yahoo.com> <1312978293.949108.1466715441953.JavaMail.yahoo@mail.yahoo.com>
Xref csiph.com comp.lang.python:110448

Show key headers only | View raw


David Shi via Python-list <python-list@python.org> writes:

> Which one is the best XML-parser?

"best" is not an absolute term but depends on criteria/conditions.


There are essentially two kinds of parsers: incremental parsers
which parse the structure and report events for everything they see
and non-incremental parses which transform the complete XML
into a data structure.

You want an incremental parser if the XML documents are so huge that
you must process them incrementally rather than have a data structure
representing the whole document (in memory). Incremental parsers
for XML are usually called "SAX" parsers.

If your XML documents have moderate size, you might prefer
a non-incremental parser.


Personally, I like "lxml" (a binding to the "libxml2" C-library).
It supports a lot of features: besides simple parsing, it supports
verification against XML-schema and DTDs, XPath and XSLT-transforms.
This means, with one XML tool you can handle all tasks typically
encoutered with XML processing.

However, "lxml" depends on an external C-library ("libxml2").
Therefore, it might be considered more difficult to install
than "pure python" XML parsers.

These examples show: "best" depends on your situation, your tasks
and your preferences.

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


Thread

Re: Which one is the best XML-parser? dieter <dieter@handshake.de> - 2016-06-24 08:39 +0200

csiph-web