It seem that _get_type_or_substitute (ZSI/TCcompound.py) is not compatible with
substitutionGroup attribute in XML Schema. It checks that sub is derived from
base class directly ( isinstance(sub, typecode.__class__) ) and that sub is not
element ( isinstance(sub, ElementDeclaration): ). But according to XML Schema
definition elements with substitutionGroup attribute may be substituted (not
always :) ). Still derivation of substitution element type from base element
type must exist.
It may lead to problems like this one
http://sourceforge.net/mailarchive/message.php?msg_id=37191865
(only like, since that problem was solved by using _Def instead of _Dec).
Here what W3C state about SG attribute (http://www.w3.org/TR/xmlschema-1/):
3.3.6 Constraints on Element Declaration Schema Components
...
Schema Component Constraint: Substitution Group OK (Transitive)
For an element declaration (call it D) to be validly substitutable for another
element declaration (call it C) subject to a blocking constraint (a subset of
{substitution, extension, restriction}, the value of a {disallowed
substitutions}) one of the following must be true:
1 D and C are the same element declaration.
2 All of the following must be true:
2.1 The blocking constraint does not contain substitution.
2.2 There is a chain of {substitution group affiliation}s from D to C,
that is, either D's {substitution group affiliation} is C, or D's {substitution
group affiliation}'s {substitution group affiliation} is C, or . . .
2.3 The set of all {derivation method}s involved in the derivation of
D's {type definition} from C's {type definition} does not intersect with the
union of the blocking constraint, C's {prohibited substitutions} (if C is
complex, otherwise the empty set) and the {prohibited substitutions}
(respectively the empty set) of any intermediate {type definition}s in the
derivation of D's {type definition} from C's {type definition}.
...
Since substitutionGroup attribute is not used in parsing of xsd (maybe I'm not
right and it's supported?), only 2.3 is interesting.
Also, parsing of incoming requests with substituted elements is not working.
This may be fixed in ugly way by assuming that all elements are in
substitutionGroup relationship and adding checks for type derivation (only two
places are involved, _get_type_or_substitute and ComplexType.parse)
PS Simple xsd with substitutionGroup attribute and valid xml for it are
attached
Pavel
Logged In: YES
user_id=1714889
Originator: NO
Not transitive but working (trunk revision 1360). It seem that
transitive substitutionGroup usage is too rare to implement it's support.
thx
Pavel