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.
Requirements
Python 2.7
Example
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 @ { '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/', template)
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
Release history Release notifications | RSS feed
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.0.tar.gz
(4.6 kB
view details)
Built Distribution
xml2data-0.1.0-py2.7.egg
(8.5 kB
view details)
File details
Details for the file xml2data-0.1.0.tar.gz
.
File metadata
- Download URL: xml2data-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d83330936dd34c740cfcd375d2ac80b60861f86b1af093b685c4feb10887a93 |
|
MD5 | 9f65c7b5c2e645c72be1e66b5ae35373 |
|
BLAKE2b-256 | adfe23208fa53c7e22c6196292c8e9c861c41634c176b668b15480c10a5ee499 |
File details
Details for the file xml2data-0.1.0-py2.7.egg
.
File metadata
- Download URL: xml2data-0.1.0-py2.7.egg
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868236364d57d023b9aa25e359e324455982822a1d3aa8f9dc5db9b9267df868 |
|
MD5 | 21223aaa800a8d0345d47b780f80fc82 |
|
BLAKE2b-256 | 1e98aa2eaf8620b3a0537af8daf528903de2fb7ca9c45d7edf8335a94a42017f |