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?

From dieter <dieter@handshake.de>
Newsgroups comp.lang.python
Subject Re: Which one is the best XML-parser?
Date 2016-06-24 08:39 +0200
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>

Show all headers | 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