Skip to main content

About GeneralMarshall

GeneralMarshall is a package for manipulating XML. It is comprised of an abstract class that should be subclassed for usage.

License

GeneralMarshall is released under the GNU Greater Public License. Feel free to reuse or distribute it in any way you see fit. I would appreciate being notified if you use the library and/or have any feature requests or suggestions.

Usage

The class makes extensive use of an overriden __getattr__ and __setattr__ in order to allow XML tag values to be set with a pythonic programming interface. In order to make this possible, the XML file’s tag heirarchy must be defined in the subclass that implements GeneralMarshall. This is done by setting the private class attributes _namespace, _root_name, _unique_tags, _unique_tag_attributes and _tag_hierarchy.

When the subclass knows the possible structure of XML files it should use, the interaction can look like this:

import general_marshall
class MyXML(general_marshall.XML):
    ...

# Load XML file
xml_object = MyXML("file_name.xml")
# Print pretty printed XML to stdout
print(xml_object)
# Create empty XML object
new_xml = MyXML()
# Set a tag value, creating parent nodes if necessary
new_xml.value = "something"
# Export to file
new_xml.export("output_file.xml")

Although lxml is used to interface with the XML file that is either read or created, not all of the functions that GeneralMarshall would profit from lxml most are used in order to maintain compatibility with Python’s builtin xml library. This is due to the fact that GeneralMarshall is used in some places where lxml is not available.

Versioning

Version numbers are set using Semantic Versioning.

Metadata

Release files for GeneralMarshall v1.0.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 GeneralMarshall v1.0.3
File Size Uploaded Provenance Actions
GeneralMarshall-v1.0.3.tar.gz 16.2 kB Without provenance Details for GeneralMarshall-v1.0.3.tar.gz

Release files / GeneralMarshall-v1.0.3.tar.gz

Download URL GeneralMarshall-v1.0.3.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
924fcd0dd0bae7b16ca86f72499cafa3a3886ba11a3f872b451e12be469c3316
BLAKE2b-256 checksum
How to use checksums
c709d040702b5141a976a50a39c03e7307d37bed38a2cde0c668f6ff048b7ce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for GeneralMarshall v1.0.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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