Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

a library for converting xml into native data

Project description

xml2data is a library for converting xml into native data, according to css-selector like template.


Python 2.7


the following converts a webpage containing some app information:

import xml2data
template = """{
  'apps': [div#main-container div.section:first-child div.goods-container div.goods @ {
      'url': a $[href],
      'description': div.goods div.bottom
  'author': div#main-container div.section div.text p a:first-child $text,
  'twitter': div#main-container div.section div.text p a:nth-child(2) $[href]
data = xml2data.urlload('', template)


data == {
  'apps': [{
      'name': 'copipex',
      'url': './down/',
      'description': '<コピー⇒貼付け> が <マウスで範囲選択⇒クリック> で可能に'
    }, {
      'name': 'gummi',
      'url': './gummi.html',
      'description': 'ウィンドウの任意の部分を別窓に表示。操作も可能'
    }, {
      'name': 'PAWSE',
      'url': './down/',
      'description': 'Pauseキーで、アプリケーションの一時停止、実行速度の制限が可能に'
    }, {
      'name': 'onAir',
      'url': './onair.html',
      'description': '現在放送中のテレビ番組のタイトルを一覧表示'
  'author': 'slay',
  'twitter': ''

Project details

Download files

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

Files for xml2data, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size xml2data-0.1.0-py2.7.egg (8.5 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size xml2data-0.1.0.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page