#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Location
    Kurvi
    Posts
    490
    Rep Power
    185

    Using attribute or <tag>data</tag>


    General design question, is there any difference, or any preferences between attributes or tags? This is mostly academic question... My practical situtation is whether I should use:
    (There will be multiple "vat" -tags, but only one "site" -tag)
    Tag:
    Code:
    <site>
       <vat>
          <vat_id>123</vat_id>
          <group>
               <name>System</name>
               <location>Cuba</location>
          </group>
          <group>
               <name>General</name>
               <location>Sanchez</location>
          </group>
       </vat>
    </site>
    or Attribute:
    Code:
    <site>
       <vat id="123">
          <group>
               <name>System</name>
               <location>Cuba</location>
          </group>
          <group>
               <name>General</name>
               <location>Sanchez</location>
          </group>
       </vat>
    </site>
    The data is ... conceptual.
    Gabba Gabba Hey
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,115
    Rep Power
    9398
    It varies a bit, partly on style and partly on what parsers you'll use and what they support best. Some things are geared more towards using tags for everything.

    Personally, I prefer attributes for simple values.
    Code:
    <site>
    	<vat id="123">
    		<group name="System" location="Cuba" />
    		<group name="General" location="Sanchez" />
    	</vat>
    </site>

    Comments on this post

    • jst666 agrees

IMN logo majestic logo threadwatch logo seochat tools logo