Skip to content

icheishvili/saxypy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SaxyPy

Dealing with XML is a chore, no matter what language. It should be as easy as JSON, but for some reason it isn't. Wasn't. It is now:

import json
import saxypy

data = saxypy.parse(open('example.xml', 'r'))
print json.dumps(data, sort_keys=True, indent=4)
import saxypy

data = {
    'root': {
        'item': [
            {
                '@id': 1,
                'name': 'something',
            },
            {
                '@id': 2,
                'name': 'other thing',
            },
            {
                '@id': 3,
                '!text': 'asdfa',
            },
        ],
    },
}
print saxypy.dump(data)

That's it. As it should have always been.

About

Better XML tools for Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages