Authoring more difficult due to dependencies between attributes and elements

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.


Thanks,

PS

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