Skip to main content

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 format.

Requirements

Python 2.x

Example

the following converts a webpage containing some app information:

import xml2data
format = """{
  'apps': [div#main-container div.section:first-child div.goods-container div.goods @ {
      'name': div.top span.name,
      'url': div.top span.name 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('http://hp.vector.co.jp/authors/VA038583/', format)

results:

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

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

xml2data-0.1.0a.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xml2data-0.1.0a-py2.7.egg (8.3 kB view details)

Uploaded Egg

File details

Details for the file xml2data-0.1.0a.tar.gz.

File metadata

  • Download URL: xml2data-0.1.0a.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xml2data-0.1.0a.tar.gz
Algorithm Hash digest
SHA256 424f797486ba5f0f6fd7b9c48afad9db70e9e3e58bc8f029fbefb882db904ecd
MD5 2ea4564d8e299505e116365faf3b4c45
BLAKE2b-256 a6d9b9d1467edd2841f704f736030c6c64a2d15d25b8645e5436e2fe94899feb

See more details on using hashes here.

File details

Details for the file xml2data-0.1.0a-py2.7.egg.

File metadata

  • Download URL: xml2data-0.1.0a-py2.7.egg
  • Upload date:
  • Size: 8.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xml2data-0.1.0a-py2.7.egg
Algorithm Hash digest
SHA256 097111f7ed63efea95349a4dfd54773e24231ef1a105ebc5d6cca59b3949633b
MD5 7750d74f5f07500f2dfbc630b04e4e2c
BLAKE2b-256 2b1bc8a012452be41538bade4acb4389973cae7000921901f14b40902661dea4

See more details on using hashes here.

Supported by

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