Lists Home |
Date Index |
On Sun, 2005-05-08 at 05:39 -0700, Mukul Gandhi wrote:
> I wrote earlier that, I would like to imagine elements
> as objects(as in OO programs) and attributes as
> object's properties.. Is it right to think like this?
It can be very dangerous thinking overall. I've seen numerous examples
of poor XML design because of too literal a translation from OO
concepts. Just for one example, see  for discussion of confusion
that arises from the fact that most "object references" in XML are
As for the specific question of XML versus attributes, I still think
it's a weak approach. OO concerns such as identity and data typing
which drive the matter in program modeling have poor natural
correspondence in XML. I think you'd be fine with such an approach with
trivial examples, but the elements/attributes choice is usually trivial,
anyway, if the example is also trivial.
> So attribute ordering will not be the right concept..
Well, not so quickly. In OO, object references aren't ordered, either
(you need to use an explicit vector to get order), so element ordering
wouldn't be the right concept, either, if one were being so literal.
I think XML requires an entirely different mind-set from objects.
> The dictionary defines attribute as quality,
> characteristic, feature etc. An object's features
> (i.e. attributes) are just features! Giving an order
> to them does'nt seem right..
I also don't think this is fruitful territory. One could pick a
dictionary definition of elements (e.g. the agents of weather) where
order does matter, and one (e.g. the fundamental units of chemical
compounds) where order does (at least in the sense of structuring in the
periodic table). Again, I see nothing but misapprehension and confusion
down this road.
Just as it's dangerous to do relational modeling in an OO mind-set, and
vice versa (part of the reason those two worlds have so stubbornly
resisted merging ), it's dangerous to do XML modeling in either mind-
set, and so on.
see also debate of  at http://www.adtmag.com/article.asp?id=9090
Uche Ogbuji Fourthought, Inc.
Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html
XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html
Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/
Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html