[
Lists Home |
Date Index |
Thread Index
]
- To: Uche Ogbuji <uche.ogbuji@fourthought.com>
- Subject: Re: [xml-dev] attribute order
- From: Mukul Gandhi <mukul_gandhi@yahoo.com>
- Date: Sun, 8 May 2005 09:25:21 -0700 (PDT)
- Cc: "G. Ken Holman" <gkholman@CraneSoftwrights.com>, XML List Developers <xml-dev@lists.xml.org>
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=M+S7CtfbA/ELD9pPsLYKqT4d8qNG61PShr6pESjlC68Q5M4e/S6XRUreKBtKMDdVduBI4/bgluiWh7UcAqSH+a052e9gMg3yJS3Xn7mB0agbTZI0aSkzyNOott9aJ31JPBOK9fXxdWvwB8syLv/panfk/u2wzT6scQ2lVjwuZQc= ;
- In-reply-to: 6667
--- Uche Ogbuji <uche.ogbuji@fourthought.com> wrote:
> 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 [1] for
> discussion of confusion
> that arises from the fact that most "object
> references" in XML are
> implicit.
Now I realize, that mapping XML model(using element
containership and attributes) to OO paradigm is not
quite appropriate.. For trivial examples, we may do
so. But we cannot generalize this correspondence.. I
read your article [1]. Really a nice article. You have
given an example to model a library inventory with
XML.. I would like to say a bit about this XML
structure you gave -
<library>
<name>The XML Institute Public Library</name>
<books>
<book isbn="0764547607">
<title>The XML Bible, 2nd Edition</title>
</book>
<book isbn="0321150406">
<title>Effective XML</title>
</book>
<book isbn="1861005946">
<title>Beginning XSLT</title>
</book>
</books>
</library>
/library/books/book containership structure seems fine
to me. name is a property of library (object), if we
model a real world concept.. It could have been made a
attribute instead of element (to me, having it as
attribute will match the real world view better). But
here, I'll favour aesthetics than the OO thinking.. To
me, "name" as a child element of "library" appeals
more aesthetically. It also seems more tool friendly
(like to an XML editor).. For e.g. if a description
becomes too long (e.g. name) , making it an attribute
is not quite readable. Also if there are chances of
existence of newline in data, I'll prefer to make the
information as element..
So it seems to me now, that designing an XML document
is also an art, than a pure science..
> 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.
I agree with you..
> > 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.
Your point seems right to me.. Sometimes, it may seem
tempting to impose ordering semantics on attributes.
But it will not be wise to design applications based
on "attribute ordering semantics" (as XML spec
prohibits this). In such case, either we should model
information as container elements, or let the
application take care of attribute ordering (for e.g.
applications may sort attributes by name)..
> I think XML requires an entirely different mind-set
> from objects.
Yes.. Now I realize!
> 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.
I just thought.., dictionary meaning of attribute may
match XML attribute concept.. I guess, I was wrong to
think like this.. XML attributes are just name value
pairs seperated by = sign. There is no other meaning
attached to this construct.. We can utilize this name
value = construct(i.e. attributes) within applications
in any way we wish..
> 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 [2]), it's dangerous to do XML
> modeling in either mind-
> set, and so on.
I read your artcile [2] also.. Its nice too!
Thanks for your insightful thoughts..
Regards,
Mukul
> [1]
>
http://www-106.ibm.com/developerworks/xml/library/x-contain.html
> [2] http://www.adtmag.com/article.asp?id=8596
>
> see also debate of [2] at
> http://www.adtmag.com/article.asp?id=9090
>
> --
> Uche Ogbuji
> Fourthought, Inc.
> http://uche.ogbuji.net
> http://fourthought.com
> http://copia.ogbuji.net
> http://4Suite.org
> 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
>
>
>
-----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org
> <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at
> http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the
> subscription
> manager:
> <http://www.oasis-open.org/mlmanage/index.php>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
|