- From: Timothy W. Cook <tim@mlhim.org>
- Date: Sat, 21 Mar 2015 08:27:00 -0300
- To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
- Cc: XMLSchema-dev <xmlschema-dev@w3.org>
- Message-ID: <CA+=OU3X_K=z9gtrt4_n0Qd=2OfgjLeWRFQK6X3o7ndL-pm21JA@mail.gmail.com>
On Fri, Mar 20, 2015 at 9:46 PM, C. M. Sperberg-McQueen < cmsmcq@blackmesatech.com> wrote: > > On Mar 19, 2015, at 11:15 AM, Timothy W. Cook wrote: > > > Assertions are predicates which are required to be true for each instance > of a type; they are evaluated with the element (or attribute) being > validated > as the current node, not with the declaration of the type as the current > node. > > So, I am incorrect in assuming that a derived by restriction complexType, will have to be valid according to the asserts in the base complexType? > One complication in this example (probably not relevant to the problem, but > nevertheless a complication for anyone who wants to count enumerated > values) is that the elements 'issuer' and 'assignor' here both have a > single > enumerated value, not two or three. Apologies for the poor example. The values of the enumerations aren't the target. If your goal is to ensure that each of > the elements 'id-name', 'issuer', and 'assignor' can take any of a fixed > number of values and that the cardinality of the set of legal values for > each > element is the same, Yes, that is the goal. > then counting 'enumeration' elements in the > declaration does not necessarily get you the correct number. The assertions > you quote will count two, two, and three xs:enumeration elements in the > different simple types, but the 'issuer' and 'assignor' elements have only > one possible value. > When the values for those three elements are converted to a UI (through some programmatic process), only the id-name element might be displayed for user selection. But the instance data will require the other two elements and the application will choose those values based on the index order of the id-name. This is why is it essential to insure that when the complexType is used as a base for a restricted complexType that the author of that restriction creates the same number of enumerations for each of the three elements. Even if they have duplicate values. -- ============================================ Timothy Cook LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook MLHIM http://www.mlhim.org
Received on Saturday, 21 March 2015 11:27:29 UTC