- From: George Cristian Bina <george@oxygenxml.com>
- Date: Tue, 28 Nov 2006 12:17:44 +0200
- To: andreas.ebbert-karroum@nokia.com
- Cc: xmlschema-dev@w3.org
Hi Andreas, When you define an element to substitute other element then the element type must be derived from the type of the element it should substitute. A union of two types is not derived from string even if both types are restrictions of string, at least not according with the specification. When using string instead of anySimpleType Xerces through oXygen reports SystemID: C:\george\test\p1\test.xsd Location: 30:41 Description: e-props-correct.4: The {type definition} of element 'extendedState' is not validly derived from the {type definition} of the substitutionHead ':baseState', or the {substitution group exclusions} property of ':baseState' does not allow this derivation. URL: http://www.w3.org/TR/xmlschema-1/#e-props-correct That is it points to point 4 from http://www.w3.org/TR/xmlschema-1/#e-props-correct *** 4 If there is a {substitution group affiliation}, the {type definition} of the element declaration must be validly derived from the {type definition} of the {substitution group affiliation}, given the value of the {substitution group exclusions} of the {substitution group affiliation}, as defined in Type Derivation OK (Complex) (§3.4.6) (if the {type definition} is complex) or as defined in Type Derivation OK (Simple) (§3.14.6) (if the {type definition} is simple). *** That is this refers to Type derivation Ok (Simple) http://www.w3.org/TR/xmlschema-1/#cos-st-derived-ok *** Schema Component Constraint: Type Derivation OK (Simple) For a simple type definition (call it D, for derived) to be validly derived from a type definition (call this B, for base) given a subset of {extension, restriction, list, union} (of which only restriction is actually relevant) one of the following must be true: 1 They are the same type definition. 2 All of the following must be true: 2.1 restriction is not in the subset, or in the {final} of its own {base type definition}; 2.2 One of the following must be true: 2.2.1 D's ·base type definition· is B. 2.2.2 D's ·base type definition· is not the ·ur-type definition· and is validly derived from B given the subset, as defined by this constraint. 2.2.3 D's {variety} is list or union and B is the ·simple ur-type definition·. 2.2.4 B's {variety} is union and D is validly derived from a type definition in B's {member type definitions} given the subset, as defined by this constraint. Note: With respect to clause 1, see the Note on identity at the end of (§3.4.6) above. *** And here you can see that the only 2.2 clause that applies in this case is 2.2.3 D's {variety} is list or union and B is the ·simple ur-type definition·. Therefore B needs to be anySimpleType because D is a union. Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com andreas.ebbert-karroum@nokia.com wrote: > Hello George, > > Thanks for your valuable comments :-) Please find my answers inline below: > >> -----Original Message----- >> From: ext George Cristian Bina [mailto:george@oxygenxml.com] >> Subject: Re: Extensible enumerations in XML Schema > >> You can define the base state to be anySimpleType. Then define >> the extendedRequestState as a union: >> >> <xs:simpleType name="extendedRequestState"> >> <xs:union memberTypes="ns0:RequestState"> >> <xs:simpleType> >> <xs:restriction base="xs:string"> >> <xs:enumeration value="open.running.new1"/> >> <xs:enumeration value="open.running.new1"/> >> <xs:enumeration value="open.running.new1"/> >> </xs:restriction> >> </xs:simpleType> >> </xs:union> >> </xs:simpleType> > >>From my understanding that should also work, when the baseState is a string, but it does not. What's the reason for that? > >> As a side note, in Relax NG that is really easy > > I'm bound to XML Schema, sorry. But interesting to read, how it is done with Relax NG. > > _ __ _ _ > //\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com > `- ` > Andreas Ebbert-Karroum > Senior Software Design Engineer > Nokia Networks Services / Middleware > phone: +49-211-94123928, fax: +49-211-9412-3838 > Heltorfer Straße 1, 40472 Düsseldorf, Germany > > ---------------------------------------------------------------------- > This message is confidential. If you have received this message in error, > please delete it from your system. You should not copy it for any purpose, > or disclose its contents to any other person. Internet communications are > not secure and therefore Nokia GmbH does not accept legal responsibility > for the contents of this message as it has been transmitted over a public > network. Thank you. > Nokia GmbH, Nokia Networks is a German Company. Further information > about the Company is available from its principal offices at > Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the > website at http://www.nokia.com/ > ---------------------------------------------------------------------- >
Received on Tuesday, 28 November 2006 10:18:19 UTC