OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: When is an attribute an attribute?

[ Lists Home | Date Index | Thread Index ]
  • From: "Daniel B. Austin" <daniela@cnet.com>
  • To: Roy Tennant <rtennant@library.berkeley.edu>
  • Date: Mon, 06 Apr 1998 16:07:23 -0700

Hi,

	All three of your examples below are well-formed. The decision as to whether
properties of document objects are to be encoded as attributes or as
element content
is up to you; there is no clear cut answer. (You might note that your
example #2 below
doe not provide as much information as examples #1 & 3, because it does not
specify 
that the <BOOK> element's content is a title...it could be anything.)
	Here are some considerations that may inform your decisions regarding
attributes
and elements:

a) does the document property relate to the structure of the document? If
yes then
an element would provide better use.
b) are your target documents going to be large in terms of file size? If
so, an attribute might be a better choice.
c) is the processor/display device you are using better or faster at
parsing one or the other?
d) does the property apply to many elements in your document? ie. in
book.xml the title
might only show up once, or once at the bottom of each page. 
e) Does the author find it easier to add an element or an attribute or does
it matter?

In general I would make the case that properties that are used often and
are non-structural
in nature would be best defined as attributes and others as elements.

Regards,

D-


At 03:51 PM 4/6/98 -0700, you wrote:
>I've been trying to figure this out for a while with no success. It seems
>to me that there are several quite different ways one can encode
>information in XML. Are all of the following correct? When and why would
>you choose one over another? Does it matter? Thank you for your indulgence
>as I puzzle out what must surely be readily apparent to most of you.
>
>Example 1:
>---------
>
><BOOK TITLE="The Call of the Wild" AUTHOR="London, Jack"\>
>
>Example 2:
>---------
>
><BOOK AUTHOR="London, Jack">The Call of the Wild</BOOK>
>
>Example 3:
>---------
>
><BOOK>
>   <TITLE>The Call of the Wild</TITLE>
>   <AUTHOR>London, Jack</AUTHOR>
></BOOK>
>
>Thanks,
>Roy Tennant

Daniel Austin 	daniela@cnet.com
Director of Development, Corporate Creative Services 
CNET: The Computer Network (415) 395-7800 x1438
"To change the old into the new, and the shapes of things to come..."

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS