Skip to content

Get Started

XML Support

As you probably already know, DDEX relies heavily on XML.

This package is a lightweight, generic module you can use to easily create and validate DDEX XML documents – for any schema that python can parse.

For example, we can create a DDEX XML document from a Python object:

from ddex import xml_to_ddex

ddex = xml_to_ddex(path="Audio.xml")
ddex.assert_valid()

Schemas can be automatically generated or can be manually submitted.

from ddex import load_ddex_xsd_schema, xml_to_ddex

schema = load_ddex_xsd_schema(path="release-notification.xsd")
ddex = xml_to_ddex(path="Audio.xml", schema=schema)

ddex.assert_valid()

JSON Support

from ddex import json_to_ddex

ddex = json_to_ddex(path="Audio.json")
ddex.assert_valid()

ddex.to_json(output_file="Audio_output.json")

Creating your own python modules

You might also find it useful to create your own modules for DDEX objects.

It's not a great idea to constantly load and create DDEX objects, for one reason that they don't change often, and secondly because you can save lots of time and work by not constantly downloading files.

from ddex import generate_ddex_module

generate_ddex_module(
    input_path="ern/42/release-notification.xsd",
    module_output_path="my.api.schemas.ern42",
)

# You can then import the module (my.api.schemas.ern42)
# and use it just like any other python module