global Elem names globally unique Re: SV: Element names guidelines

Bryan Rasmussen wrote:

>
>
>You have an element that you want to match the concept car description how
>would you naturally embody that concept in xml?
>
>wouldn't it be 
><car>
><description></description>
></car> 
>(obviously there are numerous designs patterns that one might use but I will
>stick with this one for the point of this post)
>
>  
>
This makes sense to me.

>Instead what seems to happen with structures where xml schema is used is
>that you get naming conventions like this
>
><Car>
><CarDescription></CarDescription>
></Car> 
>
>In fact this is the naming convention where I work.
>
>  
>
I find that redundant, but you seem to be aware of the problem.

>this naming convention seems to be related to naming conventions often used
>in certain object oriented languages and of course in that we want to be
>  
>
Well, it is not related to the languages at all, this is an issue of 
modelling things, and giving names to elements of the model.

>able to say that a description of a car has various limitations on it that a
>generic description might not. (Which in the case of my work is also related
>to naming and design rules that do not allow local declaration of elements
>but require all elements to be globally declared)
>  
>
You are admonishing the restriction that global element declarations 
introduce element names.
I agree that this is needlessly restrictive, because if element 
references would include the element *type name*, then there would be no 
reason not to allow 20 different element declarations for "description" 
(provided they all declare different, named types). E.g.:

<!-- not legal in XSD -->
<element name="description" type="CarDescType">
<element name="description" type="BikeDescType">
<element name="description" type="FooType">

....<element ref="description" type="FooType"/>....

*However* considering that you can simply write (introducing a local 
element declaration)

....<element name="description" type="FooType"/>....

the problem seems marginal (although it complicates for instance 
generating a schema from a bunch of class definitions).

>I believe that this an example of the drawbacks of xml schema as an xml
>validation language, not to mention its drawbacks as a language in the areas
>of data typing, and data binding descriptions. 
>
>  
>
I would not go that far. It is rather a drawback of your naming and 
design rules.

Indirectly, one could say if it is hard to make reasonable naming and 
structuring conventions, than the language does not provide a great help 
to structuring (which comes back to the problem of element references 
above).

What could be the rationale for this restriction, namely that globally 
declared element names must be unique ? Is it because globally declared 
elements may appear as the root (couldn't an attribute root=true have 
done that job)? Is it to make element references simpler? For uniformity?

kind regards,
Burak Emir
--

Burak Emir

http://lamp.epfl.ch/~buraq

Received on Tuesday, 23 November 2004 09:46:14 UTC