Convert objects to XML quickly and easily.
Features
Easily convert objects using an XML template.
Supports node lists and sub-documents.
Objects don’t need to know about XML paths, flat objects can become deep XML documents.
Dynamically inject XML at creation time.
Examples
Simple document:
from obj2xml import XML_Object, XML_Property, XML_TextProperty
class MyExampleXML(XML_Object):
version = XML_Property(['root', 'version'], 1.0)
test_value = XML_Property(['root', 'test-value'], 'Default Value')
no_default_value = XML_Property(['root', 'no-default'])
text_node = XML_TextProperty(['root', 'text-node-1'])
manual_text_node = XML_Property(['root', 'text-node-2', '_text'])
obj = MyExampleXML()
obj.test_value = 'Another value'
obj.no_default_value = 'This value was hidden before'
obj.a_text_value = 'Over-rode the default text'
obj.text_node = 'This is some text'
obj.manual_text_node = 'This is some more text'
print(obj)
<?xml version="1.0" ?>
<root no-default="This value was hidden before" test-value="Another value" version="1.0">
<text-node-2>This is some more text</text-node-2>
<text-node-1>This is some text</text-node-1>
</root>
For further examples, look in the examples directory.
Dependencies
Metadata
Release files for obj2xml 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| obj2xml-1.0.1.tar.gz | 3.4 kB | Without provenance | Details |
Release files / obj2xml-1.0.1.tar.gz
| Download URL | obj2xml-1.0.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ab44a23cfa1fd267f5cd12b3c2718cf4af74e123f5e07ff83d79bc038f10f34
|
|
BLAKE2b-256 checksum How to use checksums |
fb2e1c001437dd4e3579beb9536f7bae59c312add52c8dc4e1888d43e49974c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for obj2xml 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.