[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Using Wrapper Elements in Schemas - Any Best Practices?

  • From: Paul Spencer <paul.spencer@alphaxml.com>
  • To: "Magick, Brian" <Brian.Magick@COMPAQ.com>, xml-dev@lists.xml.org
  • Date: Mon, 24 Sep 2001 17:40:05 +0100

lead.wrapper
I would say this is common practice. The reason you mention is one reason, although this is a design-time issue, in that you know that you need the attributes when you decide whether to add the wrapper. There is also a use-time issue - it is much easier to iterate over the "symptom" elements in XSL if they are in a wrapper (especially if there are other "symptom" elements around in the document). I can't see any downside apart from a minor increase in document size. I am sure others can come up with other benefits.
 
Regards
 

Paul Spencer
CTO, alphaXML Ltd
author: Professional XML Design and Implementation (Wrox Press)
co-author: Beginning XML, Professional XSL (Wrox Press)
XML services for industry and Government
+44 (0)1491 630053
http://www.alphaxml.com/

-----Original Message-----
From: Magick, Brian [mailto:Brian.Magick@COMPAQ.com]
Sent: 24 September 2001 15:38
To: xml-dev@lists.xml.org
Subject: [xml-dev] Using Wrapper Elements in Schemas - Any Best Practices?

Are there any best practices for using wrapper elements in XML Schemas?  We are having an internal debate on the merits of using wrappers, I summarize my opinions below.

The debate……should a set of symptoms be represented by a series of symptom tags alone or should they be contained in a <symptoms> wrapper element.

 

<symptoms>

<symptom> This is symptom 1 </symptom>

<symptom> This is symptom 2 </symptom>

<symptom> This is symptom 3 </symptom>

</symptoms>

 

My initial thoughts:  I think wrappers are useful when you need to group some tags and possibly need a lead wrapper element to capture some attributes or metadata.  For example (yes this might be a bit silly) perhaps we want to know the symptoms based on how long they have been persisting.  Maybe some symptoms have been around for 7 days and other for just 3.  The following XML, using wrapper elements, accomplishes the description of this quite well.

 

<symptoms duration=”3”>
  <symptom>cough</symptom>
  <symptom>sneezing</symptom>
  <symptom>runny nose</symptom>
</symptoms>

<symptoms duration=”7”>
  <symptom>dizziness</symptom>
  <symptom>stomach ache</symptom>
</symptoms>

 

Of course, this is just my opinion, and one I would like some community backing for before I espouse this as a “best practice” within my organization.  This might just be a matter of style, but I’m interested in how other developers are determining this.

 

Brian Magick

 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.