Re: Attributes or not Attributes ?

Andrew Bunner (bunner@massquantities.com)
Tue, 08 Sep 1998 15:40:39 -0700


--=====================_16511269==_.ALT
Content-Type: text/plain; charset="us-ascii"

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
--=====================_16511269==_.ALT
Content-Type: text/html; charset="us-ascii"

At 04:03 PM 9/8/98 -0600, you wrote:

>From the Microsoft site
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

--=====================_16511269==_.ALT--