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. <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”> 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 |