Reputation: 13929
Which one of two XML structures below do you prefer? Why? Any other suggestion is welcome :)
<Parameters>
<Parameter id=username>metdos</Parameter>
<Parameter id=password>123</Parameter>
</Parameters>
or
<Parameters>
<username>metdos</username>
<password>123</password>
</Parameters>
Upvotes: 2
Views: 1848
Reputation: 16818
Although the design of an XML structure may be a matter of preference, I like the second one. Your question seems to be one that has been discussed many times. The following links should be of help.
Upvotes: 4
Reputation: 22655
It depends on the context of what you are trying to achieve. In general, I would prefer the second structure. It is well defined and easy to understand.
However, the first structure would be useful for scenarios where you don't know what parameters you will be supporting ahead of time or where you don't want your schema to change when additional parameters are introduced.
Upvotes: 2
Reputation: 1770
The second one because it is more in line with what XML is supposed to be. However, if you really need to use the first one then it should be something like
<Parameter id="username" value="metdos" />
Upvotes: 2