XML Attributes interview questions
XML Attributes - posted on August 27, 2008 at 17:10 pm
by Amit Satpute
Explain XML Attributes with an example.
The attributes in XML provide additional information about elements. Take a
look at the following example:
<book name = “Da Vinci Code”>
XML Elements vs. Attributes.
XML elements as well as attributes can be used to provide the same information
about an entity in an XML database. The only difference lies in the way they
are written. For example:
<book name = “Da Vinci Code”> ..... is an example of using
attributes.
The same information can be provided in the element form as follows:
<book>
<name>Da Vinci Code</name>
</book>
What are the problems with using XML attributes?
It is preferred storing the data using the XML elemental form as it becomes very
convenient to access and modify the data. Also the use of attributes is limited
as they cannot contain multiple values, cannot contain tree structures nor are
expandable.
|