[NEWBIE] Restrictions on attributes

poematrix

Usenet Archive
Joined
Mar 12, 2004
Messages
2
Reaction score
0
Hi group.

When I declare an element <some-element name=...> are there any restrictions on how many times I may assign a value for one and the same attribute name? I.e. is it legal to define an XML element that will contain unlimited recurrences of one and the same attribute, such that the following element definition would pass as legal:
<some-element attribute1="value 1" attribute1="value 2" attribute1="value 3" /> with all three values defined for the same attribute1 being equally available? Certainly, I can implement a software that would support such construct, but is it legal, i.e. does it conform with XML specs?

TIA,
Joseph
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
poematrix wrote:

When I declare an element <some-element name=...> are there any restrictions on how many times I may assign a value for one and the same attribute name? I.e. is it legal to define an XML element that will contain unlimited recurrences of one and the same attribute, such that the following element definition would pass as legal:
<some-element attribute1="value 1" attribute1="value 2" attribute1="value 3" /> with all three values defined for the same attribute1 being equally available? Certainly, I can implement a software that would support such construct, but is it legal, i.e. does it conform with XML specs?

It is not possible to have several attributes with the same name, you would need to use a list of values for one attribute e.g. <some-element attribute="whatever whatelse"> or use child elements e.g. <some-element> <value-list> <value>value 1</value> <value>value 2</value> .. </value-list> </some-element>
 

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,042
Messages
3,104,224
Members
248,132
Latest member
henrywalsh

Latest Threads

Top