RE: [Non-DoD Source] use cases of xs:any [strict, lax] (UNCLASSIFIED)

CLASSIFICATION: UNCLASSIFIED

Mukul,

It has been a long time since I have looked at this, but from memory here is my thinking:

The use case is to account for uncertainty, particularly with regard to the import of foreign schemas.  In a perfect world all schemas will be strictly typed, well defined, highly specific, and static.  Unfortunately, you can only account for what you own and manage.  There are many times when you may require a foreign schema as a dependency that is either imprecise or variant.  Wildcards, such as any, allow some protection from uncertainty.  When an include/import is specified within an xs:any element they are confined to the lexical scope of that xs:any element without that containing element providing or imposing a name or structure of its own.

Another use case is creative flexibility.  XML allows any abstract text to reside in a document provided it is escaped as a CDATA section.  CDATA sections allow for code that provides presentation and interaction without consideration by the XML parser.  While CDATA provides some front-end flexibility it does not provide accessibility.  It may be necessary to allow users to write custom code into a document that validates against a schema but is still interpreted as structured XML for the point of describing content.  If, for example, you were writing an HTML replacement that allows expressive freedom you may provide an xs:any element whose contents still require conformance to XML without conformance to the definition of a schema.  I strongly recommend against this approach as schema is flexible enough that you should be able to provide sufficient freedom, with a bit of practice, without need for wildcards.

My suggestion is to generally avoid use of wildcards and proceed with extreme deliberation exceedingly rarely.

Austin


-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com] 
Sent: Tuesday, March 19, 2019 8:23 AM
To: xmlschema-dev@w3.org
Subject: [Non-DoD Source] use cases of xs:any [strict, lax]

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



CLASSIFICATION: UNCLASSIFIED

Received on Tuesday, 19 March 2019 12:08:11 UTC