MR
Answered On : Jul 13th, 2011
Consider the following XML code snippet:
is the element, and first-name is the attribute.
Code
<name first-name="Raj">Kumar</name>
Login to rate this answer.
Manasa
Answered On : Oct 13th, 2011
Code
<person sex="female">
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
<person>
<sex>female</sex>
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
In the first example sex is an attribute. In the last, sex is an element. Both examples provide the same information.
Login to rate this answer.