W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2001

Authoring more difficult due to dependencies between attributes and elements

From: Peter Stark <pstark@telia.com>
Date: Sun, 6 May 2001 12:50:03 +0200
Message-ID: <004b01c0d61a$4e0a3740$fea141d5@pstark>
To: <xmlschema-dev@w3.org>
Here is one problem I have found with XML Schema:

Dependencies between the presence of attributes and elements make authoring
more difficult.

There are several cases in XML Schema where, depending on the presence of
one attribute, only a subset of the other attributes may be used. And there
are also cases when one attribute may not be used depending on what elements
the element contain at the moment. For example, the "name" and "ref"
attributes, the "type" attribute and the simpleType elements. Also, the
"ref" attribute cannot be used on a global declaration or type definition;
depending on the location of the element, different attributes may be used.

Normally this is something that should be avoided in the language design, to
make it easier for the user that does not have to remember which attributes
may be used when. Why did the XML Schema WG not design the syntax so that
these kind of errors would have been impossible to make? (Wherever an
element is legal, all its attributes are legal too.)

These errors cannot be detected by simply validating the schema (in an
authoring tool), so they will not be detected until the schema is used (then
the schema validator will detect it and signal an error).

Here are a few suggestions for making XML Schema easier to use, with regards
to this problem:

* A <ref> element could be used for references, rather than using the "ref"
attribute that makes most of the other attributes and content redundant
(even illegal)

* Special elements could be used for global definitions, which would not
have the "ref" attribute.

* Remove the "type" attribute and always use an element to define the type
(either an element or an attribute, not both)

I hope tools will be designed to help authors, that sooner or later will
include both "type" attributes and simpleType elements.


Received on Sunday, 6 May 2001 06:49:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC