Skip to main content

libComXML

Project description

# libComXML

This library permits XML generation from Python objects

```xml
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
</CATALOG>
```

```python
from libcomxml.core import XmlModel, XmlField


class Cd(XmlModel):
def __init__(self, 'CD'):
data = XmlField('CD')
title = XmlField('TITLE')
artist = XmlField('ARTIST')
country = XmlField('COUNTRY')
company = XmlField('COMPANY')
price = XmlField('PRICE')
year = XmlField('YEAR')


class Catalog(XmlModel):
def __init__(self, 'CATALOG'):
self.cds = []


catalog = Catalog()
cd = Cd()
cd.feed({
'title': 'Empire Burlesque',
'artist': 'Bob Dylan',
'country': 'USA',
'company': 'Columbia',
'price': 10.90,
'year': 1985
})
catalog.cds.append(cd)
cd = Cd()
cd.feed({
'title': 'Hide your hear',
'artist': 'Bonnie Tyler',
'country': 'UK',
'company': 'CBS Records',
'price': 9.90,
'year': 1988
})
catalog.cds.append(cd)
catalog.build_tree()
print catalog
```

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

libComXML-2.0.1.tar.gz (16.6 kB view details)

Uploaded Source

File details

Details for the file libComXML-2.0.1.tar.gz.

File metadata

  • Download URL: libComXML-2.0.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for libComXML-2.0.1.tar.gz
Algorithm Hash digest
SHA256 4d5e8fbeae0d0ad23892adbfd909ebe128732f4474124afa38ba950db7c49b2c
MD5 a1911f66c5cca08aa24de1880574facf
BLAKE2b-256 4736cf95b2220d6dee7976c84099d2985efe7a351af827dbd4965f9509eec836

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