|
RE: XML: is this a good convention?
|
Tom Ritchford
|
May 18, 2001 10:20 PDT
|
they say:
| | The most fundamental difference, which will likely continue to hold
through future iterations of XML development, is that elements can
contain child elements as well as content, while attributes can only
hold content. If it seems at all likely that you'll need to break
down the information stored in a container, make that container an
element.
|
so:
attributes MUST be leaves of the DOM tree
elements can be either leaves or nodes of the DOM tree.
| | One way to look at elements and attributes suggests that elements
are the 'real' containers of data, while attributes annotate
elements with additional information describing the content of the
element.
In the case of empty elements, attributes provide additional
information about why the element is present and possibly about what
content it represents.
|
well. that's clear enough as a rule of thumb.
I'm still unconvinced either way but would tend to use a mixed
style myself (ie, some attributes and some elements) because
it's perhaps clearer and involves less typing,
and I'd use conventions similar to these...
However, it seems strange to have to two ways to do inclusion.
/t
...electronic a cappella madness <http://volectrix.com>.........
...extreme internet radio <http://extremeNY.com/radio>...
|
|
 |
|