OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML Schemas: Best Practices

[ Lists Home | Date Index | Thread Index ]
  • From: "Roger L. Costello" <costello@mitre.org>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 12 Oct 2000 13:51:27 -0400

Hi Folks,

I am very pleased with the discussion that we are getting on the
"element versus type" issue:

   "When should an item be declared as an element 
    versus when should an item be declared as a type?"

Below are two of the messages that have been received which address this
issue.  I see a pattern emerging from these messages.  Please let me
know if you see the same or a different pattern.

"Michael W. Ripley" wrote:
> 
> I think it's a matter of style.  As you showed in your examples, you
> can basically get done what needs to get done with either method.
> 
> My take on the style would be to use an element when all components
> of the element declaration will be reused and semantically the reuse
> will mean the same thing (Elevation, BostonElevation,
> FrankfurtElevation, SidneyElevation, etc.), and to use a type when
> the type definition will be reused for semantically different
> elements (e.g., a 'money' type definition that is reused for elements
> UnitPrice, Subtotal, ShippingAndHandling, Total, etc.).

Here's my interpretation of this message: 

- Declare an item as an element when the semantics of the item is to
remain unchanged (such as when you want to create synonyms/aliases). 

- Declare an item as a type when you want to associate multiple
different semantics to the item.

Paul Spencer wrote:
> 
> By re-using the address as a data type not an element, I have
> created two different address-type elements with different names. 
> This is a benefit of re-using types rather than elements. 

I interpret this to mean: the benefit of declaring an item as a type is
that the item can be associated with multiple different semantics.

> On the other hand, there are instances where you will always give 
> the resulting element the same name. 

I interpret this to mean: an item should be declared as an element when
the item is to always have the same semantics.

Summary:

"Here are guidelines for when to declare an item as an element versus
when to define it as a type: during the lifespan of an item, if it is to
be associated with multiple semantics then create a type definition. 
If, on the other hand, the item's semantics are to remain constant over
its lifetime, but multiple synonyms/aliases are to be used for the item
then declare it as an element."

Do you agree with these guidelines?  Perhaps these guidelines are too
abstract?  If you were given these guidelines would you be able to make
a decision on whether to define an item as an element or as a type?  Are
there other things that you would add to the guidelines?  /Roger





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS