SpongeBob
SpongeBob

Reputation: 145

How to correctly use GenerateDS for DDEX XML binding

I am interested in Python XML binding for reading input files conforming to this schema: http://ddex.net/xml/ern/341/release-notification.xsd

This XSD depends on a number of other ones though, most importantly: http://ddex.net/xml/20120404/ddexC.xsd and http://ddex.net/xml/20120404/ddex.xsd

My first attempt is by using generateDS. I am able to successfully generate binding for release-notification.xsd if I use --no-process-includes with:

./generateDS.py --no-process-includes -o release-notification.py release-notification.xsd

However, this leaves me with a Python object that is mostly useless since most of the ComplexTypes are defined in ddexC.xsd.

If I try it without --no-process-includes, I get:

RuntimeError: Extension/restriction recursion detected.
Suggest you check definitions of types ArtistRole and ArtistRole.

The definition referred to is this one:

<xs:element name="ArtistRole" maxOccurs="unbounded" type="ddexC:ArtistRole">
....
<xs:complexType name="ArtistRole">
      <xs:simpleContent>
         <xs:extension base="ddex:ArtistRole">
....

So it seems like the ddex and ddexC namespaces get mixed up somehow and a circular reference is created.

Any advice here?

Upvotes: 4

Views: 1733

Answers (2)

Will Munn
Will Munn

Reputation: 7967

I have created an object model for New Release message as part of a DDEXUI I am working on which may help you, The ddex module should give you something you can use. I plan to strip it in to a separate module at some point. For an example of how to use it, see the test directory.

Upvotes: 0

Paul
Paul

Reputation: 11

You may want to check out https://github.com/ddexnet which has a ddex lint script which you can use to generate full python objects which are validated against the full ERN schema located at http://ddex.net/xml/2010/ern-main/32.

(The linter makes use of the ddexC namespace under the hood too).

Upvotes: 1

Related Questions