- From: Mukul Gandhi <gandhi.mukul@gmail.com>
- Date: Mon, 18 Jun 2012 21:22:26 +0100
- To: xmlschema-dev@w3.org
- Cc: Michael Kay <mike@saxonica.com>
On Mon, Jun 18, 2012 at 4:21 PM, Michael Kay <mike@saxonica.com> wrote: > Yes, this is a serious problem with the xs:restriction mechanism for defining subtypes, that you have to declare all the > parts of the content model that you want to leave unchanged, rather than the parts you are restricting away. XSD has it's own unique notion of how complexType restrictions work, and I would say you may find it quite strange if you're expecting it to work like an OO class inheritance for example. If an XSD complexType X restricts complexType Y, then informally the number of XSD particles in type X should be same as Y, and a particle at some offset in X must be a valid restriction of the particle at same offset in Y. But I do find this notion of complexType restriction sensible. > There's an unfortunate usability glitch in XSD 1.1 which we noticed too late to fix it, that when you restrict by assertion you still > need to repeat the entire content model. I think, XSD assertions are orthogonal (co-)constraints to the particle restriction constraints. Therefore while restricting XSD complex types, in addition to obeying the particle restriction rules an assertion would enforce constraints via XPath expressions on the tree rooted at an element (whose complexType is the context type). I personally don't see assertions working with complexType restrictions a glitch -- it's just that, we can use assertions during complexType restrictions if we want to apply an orthogonal co-occurrence constraint in addition to particle restriction constraints. -- Regards, Mukul Gandhi
Received on Monday, 18 June 2012 20:23:17 UTC