How you define attributes in XML?

How you define attributes in XML?

We define attribute in XML as same as HTML.But keep one thing in mind In XML every attribute should have a value,We can\'t make attribute without value in XML.Where as in case of HTML we can create attribute without value.

Example:

<student active=\"true\">

<name>Abhi</name>

<grade>A</grade>

</student>

 In above example \'student\' is a element,\'active\' is a attribute and \'true\' is a attribute value.

<student active>

<name>Abhi</name>

<score>75</score>

</student>

 This is wrong in case of XML because in this we declare attribute \'active\' without any value.But it will run in case of HTML. 



By:Vivek
Date:2014-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related XML Subjective Links

XML Subjective interview questions and answers for experienced and fresher