[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] What does "optional" mean?
- From: Frank Manola <fmanola@acm.org>
- To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
- Date: Mon, 27 Feb 2012 11:13:14 -0500
On Feb 26, 2012, at 7:38 PM, Michael Kay wrote:
> >BTW, as further illustration that data elements shouldn't be considered mandatory or optional independently of context
>
> This notion of "context" makes schema design really difficult, because most schema languages (Schematron as usual being the exception) don't have any notion that validity can depend upon context. For example, certain metadata is mandatory in a document that you are sending out to customers, but optional if it's a draft being distributed internally for approval.
Depends on the notion of "context" being used. What I said was that "it's not specific attributes or elements *by themselves* that are either mandatory or optional, it's *in the context of that data structure* that they are mandatory or optional". But I wasn't thinking in terms of parameterized declarations within a single schema. What I had in mind was that an element might be mandatory in the data structure described by one schema, but not in a data structure described by another schema. The "context" is the environment in which the element is being used. If, say, there are differences in metadata required by drafts and that required by the final product, you could have different schemas for drafts and for final products.
>
> I've seen people getting into a real mess by deciding that fields were mandatory because the data model says there must be a value, but the fact that there is a value doesn't mean the value has to appear in every message.
>
> In Saxon I've been experimenting with allowing XSD assertions to be parameterized, with the parameter values being specified at the time schema validation is invoked. It works well, except that most schema validation APIs don't allow parameters to be supplied, so it requires new APIs. One solution to that might be to allow an XSD wrapper document to supply the parameters, so when you name a schema document to use for validation, it has the parameter values already bound.
>
> Michael Kay
> Saxonica
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]