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


Groups > comp.lang.python > #110448 > unrolled thread

Re: Which one is the best XML-parser?

Started bydieter <dieter@handshake.de>
First post2016-06-24 08:39 +0200
Last post2016-06-24 08:39 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#110448 — Re: Which one is the best XML-parser?

Fromdieter <dieter@handshake.de>
Date2016-06-24 08:39 +0200
SubjectRe: Which one is the best XML-parser?
Message-ID<mailman.90.1466750406.11516.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web