(Many) XML Schema Questions
ricko at allette.com.au
Tue Dec 28 06:21:28 GMT 1999
Please cross-post questions to www-xml-schema-comments at w3c.org !
From: Tim Bray <tbray at textuality.com>
>At 05:15 PM 12/27/99 -0500, Roger Costello wrote:
>>2. The namespace spec clearly indicates that there is
>>no guarantee that there is anything at the URL referenced
>>by a namespace. However, with XML Schemas, it seems
>>that the namespace referenced in an XML instance document
>>must necessarily reference an XML Schema. Is this a violation
>>of the namespace spec
>I haven't read a recent schema draft, but if it says what you say it
>then in my opinion that would be an egregious design error.
Good news for the people concerned about this issue.
The new (Dec.) XML Schema WD does not assume that the NS directly
references an XML Schema. Rather, it says the schema "is about" a
namespace (3.1): it does not say namespace is a schema or a schema is
a namespace. (At one stage there was wording that a namespace
"guides the interpretation of an element", which I thought was a nice
way to put it.)
Instead, the WD allows an attribute, currently called targetNamespace,
on the schema element, which "associates" the definitions and
in the schema with a single namespace URI.
Then (s4.3.2) there is an attribute xsi:schemaLocation that can be
put on any instance element. It allows the location of the schema to be
declared. Actually, it allows several URLs to be declared, so that
there are fallbacks. Thus there is no policy that the namespace
URI must directly retrieve a schema: an alternative mechansim
is provided and the warning "Experience suggests it is not in general
safe or or desirable from a performance point of view to directly
deference NS URIs as a matter of course" is given.
<?Skip if not interested in Schematron?>
Interestingly, this mechanism can also be used to invoke schema
in other languages, since an XML schema does require any
declarations: for example, we could just have the XML Schema
... schematron schema
(needs namespace-aware schematon available next week)
<?Resume about XML Schemas?>
Note also the following:
* the subelements of an element can be in different namespaces
* so therefore a document may be composed from components from
many different schemas
* there is a wildcard mechanism (3.5) to say "any element" or "any
element of a particular namespace" or "any element from
the current namespace" or "any element from another namespace"
which allows frameworks.
For example, here is, I think, an XML schema that validates
that foo:y can contain any element from any other namespace
and that bar:z is a date. But it declares them as separate
components (there are other mechanisms available):
<schema:element name="y" >
<schema:any namespace="##other" />
<schema:datatype source="date" />
The XML Schema validator now knows how to validate y and z.
(The draft is not explicit about how x is treated, but it is consitent
that it would not make the document invalid if there are no
declarations available. )
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev