lists in attributes

Russ (3)

Usenet Archive
Joined
Apr 2, 2003
Messages
6
Reaction score
0
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.
 

DFN-CIS NetNews Service

Usenet Archive
Joined
Jan 20, 2004
Messages
18
Reaction score
0
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>
 

Russ (3)

Usenet Archive
Joined
Apr 2, 2003
Messages
6
Reaction score
0
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.
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% > 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.
 

Arnold M. Slotnik

Usenet Archive
Joined
Jan 29, 2001
Messages
54
Reaction score
0
(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

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top