Skip to main content

Bottom-up transformation of XML into python generators, XML, JSON or text.

Project description

This library does a bottom-up transformation of XML documents, extracting the parts that are relevant for the task at hand, and either returning it as a python generator, or serializing it to disk as XML (again!), JSON or text.

One design goal is to be able to process gigabyte-sized documents with constant memory footprint.

Inspired by the Haskell libraries Scrap Your Boilerplate, uniplate and geniplate.

Example, get the texts from all <p> tags in a document:

from xmldestroyer import xd
import sys

def p(text, _attrs, _children, _parents):
    return text

infile, outfile = sys.args

xd(infile, outfile, p=p)

This outputs a text file with the text from all <p> tags, one per line.

Works with python 2.7, 3.3, 3.4 and 3.5.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xmldestroyer-0.1.tar.gz (7.1 kB view details)

Uploaded Source

File details

Details for the file xmldestroyer-0.1.tar.gz.

File metadata

  • Download URL: xmldestroyer-0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xmldestroyer-0.1.tar.gz
Algorithm Hash digest
SHA256 98541f48e0d0970860402a86fb89c1ac89b27bae28958d9780087b36c3999dfd
MD5 d18a5140a6316d415949c6e5646d4981
BLAKE2b-256 1b597b5df057cdcb9af8d31cc37462385098da42865d47936c456d1e5d1e2242

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page