GeekInterview.com
Series: Subject: Topic:
Question: 1 of 46

XML Attributes Elements

What are XML attributes and elements? Explain with an example?
Asked by: Depthi | Member Since Nov-2010 | Asked on: Nov 1st, 2010

View all questions by Depthi

Showing Answers 1 - 2 of 2 Answers
MR

Answered On : Jul 13th, 2011

Consider the following XML code snippet: is the element, and first-name is the attribute.

Code
  1. <name first-name="Raj">Kumar</name>
  2.  

  
Login to rate this answer.
Manasa

Answered On : Oct 13th, 2011

Code
  1. <person sex="female">
  2.   <firstname>Anna</firstname>
  3.   <lastname>Smith</lastname>
  4. </person>
  5.  
  6. <person>
  7.   <sex>female</sex>
  8.   <firstname>Anna</firstname>
  9.   <lastname>Smith</lastname>
  10. </person>
  11.  

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.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.