diff options
author | Peter A. Bigot <pab@peoplepowerco.com> | 2010-03-18 09:13:45 -0700 |
---|---|---|
committer | Peter A. Bigot <pab@peoplepowerco.com> | 2010-03-18 09:14:33 -0700 |
commit | 3f2b8c75c1204d6dde0e36b724622576df8eecf1 (patch) | |
tree | c7efd5d9ba50535d0ba4ee54f82654eaba7fee43 /tests | |
parent | da9f42f77c34fc136e6d2ae05ad21e5eacfc01fc (diff) |
Trac #80: attributes treated incorrectly with multiple levels of restriction/extension
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/trac/trac-0080/multipleRestriction.xsd | 53 | ||||
-rw-r--r-- | tests/trac/trac-0080/test.sh | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/trac/trac-0080/multipleRestriction.xsd b/tests/trac/trac-0080/multipleRestriction.xsd new file mode 100644 index 0000000..dd47ec7 --- /dev/null +++ b/tests/trac/trac-0080/multipleRestriction.xsd @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.example.org/multipleRestriction" + xmlns:tns="http://www.example.org/multipleRestriction" + elementFormDefault="qualified"> + + <complexType name="Type4"> + <attribute name="anAttribute" type="normalizedString" use="optional" /> + </complexType> + + <complexType name="Type3"> + <complexContent> + <restriction base="tns:Type4"> + <attribute name="anAttribute" type="token" use="optional" /> + </restriction> + </complexContent> + </complexType> + + <complexType name="Type2"> + <complexContent> + <extension base="tns:Type3"> + <sequence> + <element minOccurs="0" maxOccurs="1" name="isSet" type="boolean" /> + </sequence> + </extension> + </complexContent> + </complexType> + + <complexType name="Type1"> + <complexContent> + <restriction base="tns:Type2"> + <sequence> + <element minOccurs="0" maxOccurs="1" name="isSet" type="boolean" /> + </sequence> + <attribute name="anAttribute" type="NCName" use="optional" /> + </restriction> + </complexContent> + </complexType> + + <element name="root"> + <complexType> + <complexContent> + <restriction base="tns:Type1"> + <sequence> + <element minOccurs="0" maxOccurs="1" name="isSet" type="boolean" /> + </sequence> + <attribute name="anAttribute" type="NCName" use="required" /> + </restriction> + </complexContent> + </complexType> + </element> +</schema> + diff --git a/tests/trac/trac-0080/test.sh b/tests/trac/trac-0080/test.sh new file mode 100644 index 0000000..67f6ea4 --- /dev/null +++ b/tests/trac/trac-0080/test.sh @@ -0,0 +1 @@ +pyxbgen -u multipleRestriction.xsd -m mr |