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: Caroline Clewlow <cclewlow@eris.dera.gov.uk>
  • To: xml-dev@lists.xml.org
  • Date: Fri, 13 Oct 2000 10:27:42 +0100

I would agree that many of the arguments appear to be based on style issues, and
it would be beneficial to ascertain whether or not
there exists a real efficiency benefit to either of the approaches as far as
parser or application manipulation of schemas is concerned.

Does anyone feel that there would be benefit from developing two identical
schemas that differ only in type or element reuse and performing
some tests on their effectiveness ?

Caroline Clewlow
DERA, UK

Paul Spencer wrote:

> I find your interpretations useful, and by publishing them here we get a
> chance to disagree, which I am about to do:
>
> I established a circumstance when I want to re-use a type and cannot re-use
> an element (both MovingFromAddress and MovingToAddress being of type
> Address). I then said that in other cases, the type will always be used to
> create an element with the same name (such as SSN). In the latter case, we
> could re-use an element (but how do we *know* how it will be used - I am
> guessing that an SSNtype will always be used to create an element "SSN").
> However, I *prefer* (and this is a style matter) to re-use the data type so
> that we have consistency and my guidelines are easier to use for novice
> schema writers. Once they are reasonably familiar with the common definition
> set, they will know, without having to refer back to the set that they
> should use SSNtype. This is hardly more verbose than re-using the element
> and gives consistency. However, as I said, it is a style issue.
>
> I would be very happy to hear from anyone who can demonstrate that one
> approach provides better performance in the parser than the other.
>
> Paul Spencer
> Author: XML Design and Implementation (Wrox Press)
> Co-author: Beginning XML (Wrox Press)
> Boynings Consulting - Delivering XML to industry and government
> http://www.boynings.co.uk/
>
> -----Original Message-----
> From: Roger L. Costello [mailto:costello@mitre.org]
> Sent: 12 October 2000 18:51
> To: xml-dev@lists.xml.org
> Cc: costello@mitre.org; Cokus,Michael S.; Pulvermacher,Mary K.;
> Heller,Mark J.; JohnSc@crossgain.com; Ripley,Michael W.
> Subject: Re: XML Schemas: Best Practices
>
> 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