> I believe that attributes have their place, as do elements. See
>
http://recycledknowledge.blogspot.com/2008/03/elements-or-attributes.html
> for my views.
ok, thanks for that, it was not yet published when I made that
research but it seems there were other discussions available on that
topic, I did not ask the good question to google.
So I must be the guy who "roar like lions" :-).
I just answer to that for my last post on that "has been" debate :
> If you don't care about whitespaces you have to trim value anyway in
both
> (except that attribute values are normalized, but in a way which is more
> confusing then useful for many users).
The problem is that if you ask for the text content of a markup which
has mixed content like the example given, you may have carriage
returns, tabs, both around and inside the result, depending on the
serializer you use.
> In general, elements are much more flexible -- you can attach metadata
> to them, you can further extend them with subelements without breaking
> existing code, its easier to internationalize their content
(xml:lang, its:dir), ...
I am often suspicious when people tell me that I have to do that
because "if, in the future, that may change, etc...", that is often a
lot of additional code for something which never happens :-).
You mean that I will not have to change my code if I change that :
<text> a text </text>
to
<text>
<article>
a
</article>
<noun>text
</noun>
</text>
The only way to do that is to ask text() on markup <text> and that
will bring me something I cannot really predict. Concerning metadata,
I think XML is already verbose enough, I try to focus on putting only
the minimum necessary data in it, and let the ways to process it in
the code, even if it is less generic or extendable.
I also have a quote (I do not know that Ralph Johnson, but...) :
Before software can be reusable it first has to be usable.
Ralph Johnson
Thanks for your interesting answers
Nico
http://debeissat.nicolas.free.fr/