lists in attributes

R

Russ

Can lists be used in attributes? For example, suppose I have an
element like this:

<x tol="-2.0 2.0">

where I am specifying a lower and an upper tolerance on x. Or, for
another example,

<poly coeff="-3.23 4.11 8.32"

where I am giving the coefficients of a polynomial. Are these legal?
Are they a good idea? Thanks.
 
D

DFN-CIS NetNews Service

On 12/02/2004, around 09:10, Russ wrote:
R>Are these legal?
Yes.

R> Are they a good idea?
No.

R> Thanks.
You're welcome. :cool:

Seriously, I would do something like

<x>
<lowerTol>-2.0</lowerTol>
<upperTol>-2.0</upperTol>
</x>

and

<poly>
<coeff>-3.23</coeff>
<coeff>4.11</coeff>
<coeff>8.32</coeff>
</poly>
 
R

Russ

DFN-CIS NetNews Service said:
On 12/02/2004, around 09:10, Russ wrote:
R>Are these legal?
Yes.

R> Are they a good idea?
No.

Why not?
R> Thanks.
You're welcome. :cool:

Seriously, I would do something like

<x>
<lowerTol>-2.0</lowerTol>
<upperTol>-2.0</upperTol>
</x>

and

<poly>
<coeff>-3.23</coeff>
<coeff>4.11</coeff>
<coeff>8.32</coeff>
</poly>

To my untrained eye, these appear more cluttered to me, without adding
any additional information.
 
P

Patrick TJ McPhee

% > R>Are these legal?
% > Yes.
% >
% > R> Are they a good idea?
% > No.
%
% Why not?

The argument usually goes that you should use XML to mark each
individual component of your data, since then your XML parser can give
you each individual component, and you then don't have to parse out the
values you want from your attribute list.

% To my untrained eye, these appear more cluttered to me, without adding
% any additional information.

The argument here goes that it doesn't matter because you would never
look at the XML without some XML-specific tool. It says so right on the
first page of the standard, although not in so many words.

You may balance this against the fact that DTDs and XML Schemas provide
a type (NMTOKENS) which is essentially intended for a white-space
delimited list of numbers, and that XML Schemas goes on to provide
mechanisms for defining your own lists of white-space delimited things,
all of which suggests that somebody who's thought about it a lot thinks
that your approach isn't so bad after all. And your approach surely is
more readable for some purposes.
 
A

arnold m. slotnik

(e-mail address removed) (Patrick TJ McPhee) wrote in
The argument here goes that it doesn't matter because you would
never look at the XML without some XML-specific tool. It says so
right on the first page of the standard, although not in so many
words.

Okay, I'll bite--where are the words that imply that?

Design goal #6 supports the opposite supposition.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top