[NEWBIE] Restrictions on attributes

P

poematrix

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
 
M

Martin Honnen

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top