How to use GenerateDS to bind XML DDEX correctly

I'm interested in Python XML binding for reading input files matching this scheme: http://ddex.net/xml/ern/341/release-notification.xsd

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

My first attempt is to use generateDS . I can successfully generate a 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, which is mostly useless, since most ComplexTypes are defined in ddexC.xsd .

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

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

The definition in question is as follows:

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

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

Any advice here?

+4
source share
2 answers

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

(Linter also uses the ddexC namespace under the hood).

+1
source

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

0
source

Source: https://habr.com/ru/post/1444431/


All Articles