Skip to main content
Build Status https://coveralls.io/repos/github/gisce/libComXML/badge.svg?branch=master

This library permits XML generation from Python objects

<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>
  <CD>
    <TITLE>Tupelo Honey</TITLE>
    <ARTIST>Van Morrison</ARTIST>
    <COUNTRY>UK</COUNTRY>
    <COMPANY>Polydor</COMPANY>
    <PRICE>8.20</PRICE>
    <YEAR>1971</YEAR>
  </CD>
</CATALOG>
from libcomxml.core import XmlModel, XmlField


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


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


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)
# Also we can add XML String directly as a new element
cd = """<CD>
        <TITLE>Tupelo Honey</TITLE>
        <ARTIST>Van Morrison</ARTIST>
        <COUNTRY>UK</COUNTRY>
        <COMPANY>Polydor</COMPANY>
        <PRICE>8.20</PRICE>
        <YEAR>1971</YEAR>
        </CD>"""
self.catalog.cds.append(cd)
catalog.build_tree()
print catalog

Release files for libcomxml 2.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libcomxml 2.2.3
File Size Uploaded
libComXML-2.2.3.tar.gz 18.1 kB Details

Release files / libComXML-2.2.3.tar.gz

Download URL libComXML-2.2.3.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3e65f64b03374e4349cc34285d0c315397b8f7a421de905141e6c92f941bf2f7
BLAKE2b-256 checksum
How to use checksums
fd3de35bfe6c3c6bb09aa0b8fcd6bb6d4c67a60bf2e13f2282b94f30a0e3da5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.2.0

1 release file

3.1.0

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

2.2.5

1 release file

2.2.4

1 release file

This release

2.2.3 This release

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page