Hi Mukul,
Yes, assertions also apply to simple type definitions [1] allowing you to
define new types like:
<simpleType name='oddNumber'>
<restriction base='positiveInteger'>
<assert test='$value mod 2 eq 1'/>
</restriction>
</simpleType>
which you couldn't before with XML Schema 1.0.
The comment in the spec you quoted applied to an earlier draft of XML
Schema 1.1. Looks like the XML Schema WG forgot to delete it before
publishing the June draft.
Thanks.
[1] http://www.w3.org/TR/xmlschema11-2/#rf-assertions
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
"Mukul Gandhi" <[EMAIL PROTECTED]> wrote on 07/27/2008 04:20:33 AM:
> Hi team,
> In the XML Schema 1.1 spec, at http://www.w3.org/TR/xmlschema11-1/
> (W3C Working Draft 20 June 2008),
>
> it's mentioned
>
> 2.2.4.3 Assertion
> Assertions are currently only allowed to be specified in complex
> types. It may be deemed useful also to include assertions in named
> model group definitions and/or attribute groups, or even simple types.
> The XML Schema Working Group solicits input from implementors and
> users of this specification on this question.
>
> The above paragraph conveys that, assertions on simple types is still
> not approved by the XML Schema WG, and discussions are still underway.
>
> But the definition of simple types in the same spec says,
>
> 3.16.2 XML Representation of Simple Type Definition Schema Components
>
> <simpleType
> final = (#all | List of (list | union | restriction | extension))
> id = ID
> name = NCName
> {any attributes with non-schema namespace . . .}>
> Content: (annotation?, (restriction | list | union))
> </simpleType>
>
> <restriction
> base = QName
> id = ID
> {any attributes with non-schema namespace . . .}>
> Content: (annotation?, (simpleType?, (minExclusive | minInclusive |
> maxExclusive | maxInclusive | totalDigits | fractionDigits | maxScale
> | minScale | length | minLength | maxLength | enumeration | whiteSpace
> | pattern | assert | {any with namespace: ##other})*))
> </restriction>
>
> The definition of <restriction above specifies, that assertions on
> simple type is available in the spec.
>
> Could you please clarify this, and should I go ahead and implement
> assertions on simple types?
>
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]