Skip to main content

Introduction

This module allows one to marshal simple Python data types into a custom XML format. The Marshaller and Unmarshaller classes can be subclassed in order to implement marshalling into a different XML DTD. Original Authors are XML-SIG (xml-sig@python.org).

Fully compatible with PyXML implementation, enables namespace support for XML Input/Output.

Implemented with lxml

Installation

python setup.py install

Testing

python setup.py test

Usage

For simple serialisation and unserialisation:

>>> from xml_marshaller import xml_marshaller
>>> xml_marshaller.dumps(['item1', {'key1': 1, 'key2': 'string'}])
'<marshal><list id="i2"><string>item1</string><dictionary id="i3"><string>key1</string><int>1</int><string>key2</string><string>string</string></dictionary></list></marshal>'
>>> xml_marshaller.loads(xml_marshaller.dumps(['item1', {'key1': 1, 'key2': 'string'}]))
['item1', {'key2': 'string', 'key1': 1}]

Can works with file like objects:

>>> from xml_marshaller import xml_marshaller
>>> from StringIO import StringIO
>>> file_like_object = StringIO()
>>> xml_marshaller.dump('Hello World !', file_like_object)
>>> file_like_object.seek(0)
>>> file_like_object.read()
'<marshal><string>Hello World !</string></marshal>'
>>> file_like_object.seek(0)
>>> xml_marshaller.load(file_like_object)
'Hello World !'

xml_marshaller can also output xml with qualified names:

>>> from xml_marshaller import xml_marshaller
>>> xml_marshaller.dumps_ns('Hello World !')
'<marshal:marshal xmlns:marshal="http://www.erp5.org/namespaces/marshaller"><marshal:string>Hello World !</marshal:string></marshal:marshal>'

You can also use your own URI:

>>> from xml_marshaller.xml_marshaller import Marshaller
>>> marshaller = Marshaller(namespace_uri='http://my-custom-namespace-uri/namespace')
>>> marshaller.dumps('Hello World !')
'<marshal:marshal xmlns:marshal="http://my-custom-namespace-uri/namespace"><marshal:string>Hello World !</marshal:string></marshal:marshal>'

History

1.0.3 (2026-09-11)

  • Drop dependency on pkg_resources, making package compatible with python3.14+.

1.0.2 (2019-02-25)

  • Python 2 fixups.

1.0.1 (2018-11-12)

  • Fix changelog.

1.0 (2018-11-12)

  • Stop distinguish unicode and bytes and always return ‘str’

0.10 (2018-09-12)

  • Add support for Python 3

0.9.7 (2010-10-30)

  • Enhance egg folder structure [nicolas Delaby]

  • Improve tests [nicolas Delaby]

  • add XSD Schema [nicolas Delaby]

0.9.6 (2010-10-12)

  • [fix] Support boolean transformation [Nicolas Delaby]

0.9.5 (2010-09-01)

  • [fix] Formatting of documentation [Lukasz Nowak]

0.9.4 (2010-09-01)

  • [fix] Instances are now correctly unmarshalled. [Cedric de Saint Martin]

Release files for xml-marshaller 1.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 xml-marshaller 1.0.3
File Size Uploaded
xml_marshaller-1.0.3.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xml-marshaller 1.0.3
File Interpreter ABI Platform
xml_marshaller-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / xml_marshaller-1.0.3.tar.gz

Download URL xml_marshaller-1.0.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c5b8bd1c0511c540ffee01d587047f89b7a31c60aa75bbff4c4efa9823de994e
BLAKE2b-256 checksum
How to use checksums
269660b57d4bf4a01db4bfd32d7bbd338b329b37079987fa48f9373445286e99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / xml_marshaller-1.0.3-py3-none-any.whl

Download URL xml_marshaller-1.0.3-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8af06a04d403457ff917a5570e0f564bc80bb74a95db9a85dc8fdf222c551b4a
BLAKE2b-256 checksum
How to use checksums
80567b5bcbf56fae25ab2a950a090809c54063b4948b4a6f0a8e1d423fec40e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

1 release file

1.0.1

1 release file

1.0

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

0.9.2

1 release file

0.9.1

0.9

0.9a

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