• 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

Parameter vs Tag

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I tried to give my co-worker good reasons why something is a parameter of a tag, versus making it an inner tag of that tag.
I went into the parameter being more of a configuration of the tag, whereas it would be a tag if the information stored is more data related.
In his example he had a <PRINTER> tag. He wanted to store Name, IP, Availability, Status, and Location. I used Location as an example.
So I told him that Name, IP, Availability, and Status where better as tags, and Location as a parameter. Since if you were converting this XML to HTML using XSLT, the first four values would be what you wanted displayed in an HTML Table, but Location is used as XSLT If statement conditions. Meaning like so
Location can be Local or Network. But where the location of the printer actually is makes no difference to the user of the HTML document, Now the HTML document and XSLT should handle the location of printers differently. Maybe local printers in Green and network printers in Red. SO since this is really just going to be used in an IF statement in the XSLT document, then it is better as a parameter.
Does this make sense. Am I smoking crack or something, or does someone else have a better answer for him. I know I had read something somewhere explaining this, but I can't remember where?
Thanks
Mark
 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it is all personal choice, really.
The group I work with has a bunch of XML files, where each element had a whole slew of attributes, and no nested tags. Why? They figured if a value is the property of something, then it is an attribute. So you end up with a tag that has 6 or 7 attributes and looks really messy. Myself, I tend to use tags more liberally and rarely rely on attributes.
I don't think there is a hard and fast rule of when to do one or the other. It probably is dependent more on the situation and what you are doing with the XML. In your case, it may make sense. In a different situation, putting location as a tag may be more feasible.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic