#169 pyxbgen stop generation when SchemaUniquenessError exception is thrown

PyXB 1.1.5
Generation Model
PyXB 1.1.4


root schema (root.xsd) containing includes as follows:

<xs:include schemaLocation="A.xsd">
<xs:include schemaLocation="B.xsd">
<xs:include schemaLocation="C.xsd">

Where A.xsd and B.xsd have the same signature.

Trying to generate bindings for root.xsd the following message is printed:

"INCLUDE B.xsd caught: "

And include C.xsd is not processed.

Attached a patch to ignore the pyxb.SchemaUniquenessError exception and allow further processing of include elements.

2 Attachments


  • Peter A. Bigot

    Peter A. Bigot - 2012-10-26

    Can you provide a reproducing case? The likelihood of two schema having the same signature but different content is supposed to be vanishingly small, and I believe the error is appropriate if the content is identical.

  • jmaroto

    jmaroto - 2012-10-29
  • jmaroto

    jmaroto - 2012-10-29

    Example attached.

    Consider the following:

    base.xsd defines some common elements that are used all over the schema, so a.xsd, b.xsd and c.xsd include it.

    a.xsd and b.xsd do not define additional elements (maybe they will do it in the future) so the signature is identical:

    0f46ae081827e9d64369fbc1b2b0aa2b c.xsd
    17b91eaa352e89f9f6ba6dce962449e2 root.xsd
    c7197fe331f11f287f816a0695a92d86 base.xsd
    ea91a6e0d812df5fdcd25e079f6f648e a.xsd
    ea91a6e0d812df5fdcd25e079f6f648e b.xsd

    Thus, pyxbgen starts processing root.xsd and stop the generation when b.xsd "duplicity" is detected, so c.xsd is not processed and not included in the binding:

    [tmp]$ pyxbgen --schema-location=xsd_example/root.xsd --binding-root=. --module=myschema
    Schema at /tmp/xsd_example/b.xsd already registered in AbsentNamespace0
    INCLUDE /tmp/xsd_example/b.xsd caught:
    WARNING: Skipped redundant translation of /tmp/xsd_example/b.xsd defining AbsentNamespace0
    Python for AbsentNamespace0 requires 1 modules
    Saved binding source to ./myschema.py

  • Peter A. Bigot

    Peter A. Bigot - 2012-10-29
    • status changed from new to accepted

    Thanks. I agree PyXB can legitimately continue on in this case. However instead of ignoring the diagnostic I'll probably make it emit a warning that it did not read the apparently redundant schema a second time, unless I can verify that the full text (not just the hash) is the same. (This is necessary because when a new information item is added, PyXB does not analyze the item check to see if it is identical to an existing item with the same name, which would be legal; instead it assumes it is different, which is not legal. Thus including the same document twice, while technically legal in XML Schema, would cause PyXB to fail.)

  • Peter A. Bigot

    Peter A. Bigot - 2012-10-30
    • status changed from accepted to closed
    • resolution set to fixed

    Fixed in pyxb-1.1/next branch:

    commit c01e47da7980427f5207345ef78db980b36d5c3d
    Author: Peter A. Bigot <pab@pabigot.com>
    Date:   Tue Oct 30 05:56:11 2012 -0500
        trac/169: pyxbgen stops generation when SchemaUniquenessError thrown
    :100644 100644 e68063f... d5d9cf4... M  pyxb/namespace/__init__.py
    :100644 100644 13e2d78... 2a0eb0b... M  pyxb/xmlschema/structures.py
    :000000 100644 0000000... e66ad85... A  tests/trac/trac-0169/a.xsd
    :000000 100644 0000000... e66ad85... A  tests/trac/trac-0169/b.xsd
    :000000 100644 0000000... 79e2fa0... A  tests/trac/trac-0169/base.xsd
    :000000 100644 0000000... 6cc62ed... A  tests/trac/trac-0169/c.xsd
    :000000 100644 0000000... cb566ff... A  tests/trac/trac-0169/check.py
    :000000 100644 0000000... 5cdb75a... A  tests/trac/trac-0169/logging.cfg
    :000000 100644 0000000... 5ed7da7... A  tests/trac/trac-0169/root.xsd
    :000000 100755 0000000... 44e2acc... A  tests/trac/trac-0169/test.sh

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks