#80 attributes treated incorrectly with multiple levels of restriction/extension

PyXB 1.1.2
closed
None
fixed
Content model
major
PyXB 1.1.1
defect
2010-03-18
2010-03-18
No

Generating from the attached XSD like this:

pyxbgen -u multipleRestriction.xsd -m mr

results in the following output:

urn:uuid:4abace1e-3282-11df-89bf-000e0ca22035
Attribute {http://www.example.org/multipleRestriction}Type1.anAttribute renamed to anAttribute_
Attribute None.anAttribute renamed to anAttribute_2
Python for http://www.example.org/multipleRestriction requires 1 modules
Saved binding source to ./mr.py

Multiple attributes are generated from anAttribute, when there should only be one:

import mr
import re
r = mr.root()
[ v for v in dir (r) if re.match(".anAttribute.",v)]

['CTD_ANON_1anAttribute_2', '_Type1anAttribute', 'Type3anAttribute', '_Type4anAttribute', 'httpwww_example_orgmultipleRestriction_Type1_anAttribute', 'anAttribute', 'anAttribute', 'anAttribute_2']

anAttribute is inherited by the complex type definition in the root element from its great-great grandparent. anAttribute_ and anAttribute_2 should not have been created, I think.

In this case, the renaming happens on every second derivation step, once on a restriction and once on an extension.

2 Attachments

Discussion

  • Peter Keller

    Peter Keller - 2010-03-18

    Example XSD illustrating defect

     
  • Peter A. Bigot

    Peter A. Bigot - 2010-03-18

    Patch to fix #80

     
  • Peter A. Bigot

    Peter A. Bigot - 2010-03-18
    • status changed from new to closed
    • resolution set to fixed

    PyXB generates unique names for each attribute declaration. An attribute
    use, which is what appears in the generated class, may be a restriction of
    another attribute use, in which case the generated names should correspond
    to the names used in that use. The code improperly traversed only a single
    restrictionOf step when determining the names to be used.

    Fixed in the trac/80 branch, and patch uploaded. Will be integrated into 1.1.2.

     

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

Sign up for the SourceForge newsletter:





No, thanks