Attributes or not Attributes ?

Andrew Bunner bunner at massquantities.com
Wed Sep 9 00:37:06 BST 1998


At 04:03 PM 9/8/98 -0600, you wrote: 
>
> >From the Microsoft site 
>
> <http://www.microsoft.com/xml/tutorial/author_doc.asp>http://www.microsoft
> .com/xml/tutorial/author_doc.asp 
>
> there is an example: 
>
> <books> 
>    <book isbn="0345374827"> 
>      <title>The Great Shark Hunt</title> 
>      <author>Hunter S. Thompson</author> 
>    </book> 
>  </books> 
>
> why isn't it: 
>
> <books> 
>    <book isbn="0345374827" title ="The Great Shark Hunt" author="Hunter S.
> Thompson" 
>    </book> 
>  </books> 
>
> or 
>
> <books> 
>    <book 
>     <isbn>0345374827</isbn> 
>      <title>The Great Shark Hunt</title> 
>      <author>Hunter S. Thompson</author> 
>    </book> 
>  </books> 
>
> So far I have understood that the 3 notations are legal. But are they
> identical ? 


  They are definitely not identical, but they are all equally valid. The only
difference is in how you access the information in your XML application. If
you
were using xt (a freeware XML processor), you could say attribute(isbn) or you
could say {isbn} to get at that value.

  I tend to use attributes in cases where the attribute value is likely to be
short and all tags of with the same name are likely to have that attribute
associated with them. Does anyone else have another (better?) rule of thumb?

-- Andrew

   Andrew Bunner
   President, Founder Mass Quantities, Inc.
   Professional Supplements for the Perfect Physique
   http://www.massquantities.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ic.ac.uk/pipermail/xml-dev/attachments/19980908/2e8b791b/attachment.htm


More information about the Xml-dev mailing list