• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Order inside the tag - MANDATORY?

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Is the order of elements inside a tag strictly to be followed?

I mean for example:

===
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
<mime-mapping>
===

Should "extension" come before "mime-type" ? If the order is not required to be followed, I hope it applies to all the tags.

Can someone explain?
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Manikandan,

In the servlet v2.3 specification, the web.xml DTD did in fact verify the proper tag ordering. However, in servlet v2.4 this ordering is no longer validated. My guess why this was done is to allow the developer to group related declarations together. For example, if you were to declare 20 <servlet> definitions and followed by 20+ <servlet-mapping> definitions, it might be confusing to read the DD. However, in v2.4 the developer can group the <servlet> and <servlet-mapping> declarations together. Thus enhancing readability of the DD.

HTH,
Bryan
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarifcation Bryan!

Yes, the advantage what you mentioned is a worthy one. Also, if you consider the tag orderings inside a tag, like the one I mentioned there ... between the extension tag and mime-type ... there is no point in enforcing that extension should precede mime-type.

It infact poses more work on the deployer to remember and define it in proper order. This Makes the DD non-user-friendly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic