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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Simple Question

[ Lists Home | Date Index | Thread Index ]

Ramkumar Menon wrote:

>  What was the fundamental motivation for having attributes in an XML 
> Document ? Whatever that can be contained in an attribute of an 
> element can be contained within a sub element. If I model an XML 
> Document as a Java object, would I need to distinguish between the 
> elements and attributes ? Moreover, why was it decided that attributes 
> can only be of a simple type ? 


Attributes were one of the big step forwards that SGML brought over 
"Gencoding", one of the
previous formats in the 70s.

Consider the following questions:
 "Why should batch files or shell commands have arguments, when all 
information can be
put through standard input/output?"
 "Why should functions or methods have more than one argument, when all 
arguments can be
put into a single object, and (perhaps) all functions Curried to accept 
single arguments
anyway?"
 "Why should natural languages have adjectives, when everything can be 
described using
verbs, nouns, adverbs etc.?"
 "Why is context (path, font, position) important for keeping track of 
the signifance of
some information in relation to other information?"

I believe the answers to each of those questions also applies to XML. 
The answer
boils down to human amenability: there is a profound human factors 
reason why the versions
of LISP that succeeded had keyword arguments and putprop/getprop (or 
equivalents),
and why commands in shellscripts/batch files take arguments. People 
understand
things having named properties, and they appreciate it when there is a 
way of
differentiating between the properties of a thing and its parts or holders.

An element name is a function (ultimately defined by the recipient as a 
relation,
semantic or presentational function) over its contents, and attributes 
parameterize this
function.

Attributes are a theory about which simple types will be used by 
recipients to handle
their contents. It is encapsulation; it says "to use this element, you 
generally will
need to also know some of these attributes; however you generally don't 
need to
know the contents or their attributes."

If you view XML as a way of sending relational data from A-B, none of this
probably will matter to you. But XML was not designed primarily to send
relational data.

Cheers
Rick Jelliffe





 

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

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