W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2019

Re: use cases of xs:any [strict, lax]

From: Michael Kay <mike@saxonica.com>
Date: Tue, 19 Mar 2019 10:09:10 +0000
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-Id: <3AE89D75-F7C8-48AA-8EE7-73CBA3887BA1@saxonica.com>
To: Mukul Gandhi <gandhi.mukul@gmail.com>
They basically define different extensibility policies. xs:any means "other elements can go here". With processContents="skip", it's "any other elements (subject to namespace constraints)". With "strict", it's "any other elements provided they are defined in the schema" -- which will typically be an extra schema module linked in using xs:include/import. With "lax" it's "any other elements, but if there is a schema definition for the element, then the element will be validated against the relevant definition".

You ask for use cases -- i.e. situations where those three policies would be appropriate. That's tougher. Deciding an extensibility policy for a schema you are writing depends on an understanding of the kind of users you will have, and how much you want to allow them to vary their usage from the core standard. This may depend, for example, on whether you are only publishing a schema, or whether you are also publishing applications that generate/consume data conforming to the schema.

Michael Kay

> On 19 Mar 2019, at 05:22, Mukul Gandhi <gandhi.mukul@gmail.com> wrote:
> Hi all,
>    I'm not very clear, what are the good use cases of following forms of XSD xs:any wildcards,
> <xs:any processContents="strict" .../>
> <xs:any processContents="lax" .../>
> Can anyone please explain this.
> I can readily imagine that, the form <xs:any processContents="skip" .../> is very useful.
> -- 
> Regards,
> Mukul Gandhi
Received on Tuesday, 19 March 2019 10:09:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:13 UTC