Re: [Moderator Action] Re: [Ann.] XML Schema FAQ

Henry Thompson writes:

>> Robert Braddock <robert@concordant-thought.com> writes:
>> 
>> > > OK, I've had a go at summarising the "How does an instance refer to 
a
>> > > schema" in http://www.schemavalid.com/faq/xml-schema.html#c5 - all
>> > > comments welcome as usual.
>> > 
>> > Am I correct in my belief that the xsi:schemaLocation attribute is 
not
>> > necessary--it's just a hint for processors that don't know how to 
find the
>> > schema for the namespace, right?
>> 
>> Yes.
>> 
>> > Or is the question really, "How can I link an instance document 
directly to
>> > a schema (as opposed to the indirect namespace linkage)?"
>> 
>> There is no direct linkage facility of any kind.
>> 
>> ht
>> 

I would put it this way: 

"Different applications require different conventions for determining the 
schema to be used for validation.  For example, an author of individual 
documents may prefer to indicate directly in the document the location of 
the schema to be used.  Conversely, an e-commerce site might depend on a 
particular vocabulary, and might not trust the user to determine the 
schema, even if the user were prepared to do so.

The schema design therefore avoids mandating a particular policy, but it 
is anticipated that users will acquire and configure processors that do 
enforce rules appropriate to their needs.  So, the schema specification 
formally provides xsi:schemaLocation as a hint:  some processors may 
follow it, others not.  The first user above would indeed do well to use a 
processor that unconditionally follows schemaLocation, and in that sense 
elevates it from a hint to a mandatory pointer.  The second user would do 
well to use a processor that either (1) ignores schemaLocation or (2) 
chooses to reject documents containing schemaLocations or (3) rejects 
documents in which the schemaLocation does not match the intended schema 
document.  Thus, by using the appropriate processor or processor mode, 
users can indeed rely on behavior appropriate to particular needs.

Note on options (2) and (3):  the schema specification calls for no such 
checking or error indications, but nothing can prevent a particular 
processor from declining to attempt a validation based on criteria that 
meet the users needs (in this case, that the user is unhappy with the 
schemaLocation occurrence or contents.)  If a validation is attempted 
against one schema or another, the schema specification is very specific 
about the required results.

One final note:  certain schemas provide default values for attributes and 
elements.  In cases where schemaLocation is not honored, users must be 
very careful to ensure that any such defaults supplied by the schema 
actually used for validation are consistent with those assumed by the 
document author.  In typical eCommerce scenarios, the company offering the 
service, or some organization in which they participate, will widely 
publicize the schemas to be used and the implications of any defaults.  At 
some point in the future, more robust means of protecting against 
unintended schema uses may be provided."

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------

Received on Wednesday, 7 February 2001 09:56:27 UTC