XML-Feedparser mit Python-Standardmodulen?
Hallo, lxml enthält einen XML-Feedparser. Der ist wunderbar geeignet, um z.B. einen XML-Baum per Socket zu lesen und jeden Block dem Parser zu übergeben. Leider ist lxml nicht Teil der "Batteries". Welche XML-Feedparser gibt es in den Python-Standardmodulen oder pure-python? Ich habe keine gefunden? -- Schönen Gruß - Regards Hartmut Goebel Dipl.-Informatiker (univ.), CISSP, CSSLP Goebel Consult Spezialist für IT-Sicherheit in komplexen Umgebungen http://www.goebel-consult.de Monatliche Kolumne: http://www.cissp-gefluester.de/ Goebel Consult mit Mitglied bei http://www.7-it.de
Hartmut Goebel, 24.03.2010 13:42:
lxml enthält einen XML-Feedparser. Der ist wunderbar geeignet, um z.B. einen XML-Baum per Socket zu lesen und jeden Block dem Parser zu übergeben. Leider ist lxml nicht Teil der "Batteries".
Welche XML-Feedparser gibt es in den Python-Standardmodulen oder pure-python? Ich habe keine gefunden?
xml.etree.ElementTree (basierent auf ElementTree 1.2.x) ist seit Py2.5 dabei. Dort gibt es den XMLTreeBuilder, der die selbe Aufgabe erfüllt. lxml.etree folgt dem Vorbild von ET 1.3, das die Klasse in XMLParser umbenannt hat. ET 1.3 wird auch in Python 3.2 drin sein. Stefan
Am 24.03.2010 15:43, schrieb Stefan Behnel:
xml.etree.ElementTree (basierent auf ElementTree 1.2.x) ist seit Py2.5 dabei. Dort gibt es den XMLTreeBuilder, der die selbe Aufgabe erfüllt.
Danke. Klasse. Ich habe immer nach "FeedParser" oder so gesucht. Und für das, was ich brauche, ist cElementTree sogar schneller (laut den Benchmarks von lxml). -- Schönen Gruß - Regards Hartmut Goebel Dipl.-Informatiker (univ.), CISSP, CSSLP Goebel Consult Spezialist für IT-Sicherheit in komplexen Umgebungen http://www.goebel-consult.de Monatliche Kolumne: http://www.cissp-gefluester.de/ Goebel Consult mit Mitglied bei http://www.7-it.de
Hartmut Goebel, 24.03.2010 23:08:
Am 24.03.2010 15:43, schrieb Stefan Behnel:
xml.etree.ElementTree (basierent auf ElementTree 1.2.x) ist seit Py2.5 dabei. Dort gibt es den XMLTreeBuilder, der die selbe Aufgabe erfüllt.
Danke. Klasse. Ich habe immer nach "FeedParser" oder so gesucht. Und für das, was ich brauche, ist cElementTree sogar schneller (laut den Benchmarks von lxml).
Als deren Autor würde ich auf die nicht viel geben. ;) Gerade die Parser-Benchmarks leiden etwas unter den nicht ganz realistischen Testdaten, außerdem wurden die Bibliotheken von Hand für die Zielmaschine übersetzt, was bei lxml sicherlich eher zu erwarten ist als bei cET in der Standardbibliothek. Für reale Daten nehmen sich lxml.etree und cElementTree wenig, da hat mal die eine und mal die andere die Nase vorn. Aber wenn cET für eine Anwendung ausreicht, ist natürlich erstmal eine ziemlich große Abhängigkeit weniger auf der Liste. Klingt so als wäre das hier eher entscheidend. Stefan
Hartmut Goebel, 24.03.2010 13:42:
lxml enthält einen XML-Feedparser. Der ist wunderbar geeignet, um z.B. einen XML-Baum per Socket zu lesen und jeden Block dem Parser zu übergeben. Leider ist lxml nicht Teil der "Batteries".
Welche XML-Feedparser gibt es in den Python-Standardmodulen oder pure-python? Ich habe keine gefunden?
xml.etree.ElementTree (basierent auf ElementTree 1.2.x) ist seit Py2.5 dabei. Dort gibt es den XMLTreeBuilder, der die selbe Aufgabe erfüllt. lxml.etree folgt dem Vorbild von ET 1.3, das die Klasse in XMLParser umbenannt hat. ET 1.3 wird auch in Python 3.2 drin sein. Stefan
participants (2)
-
Hartmut Goebel
-
Stefan Behnel