Google News
logo
XML - Interview Questions
What is an XML Element?
An XML element is everything from (including) the element's start tag to (including) the element's end tag.
<price>15.30</price>
An element can contain :
 
* text
* attributes
* other elements
* or a mix of the above
<bookstore>
  <book category="children">
    <title>Shiva</title>
    <author>Ram</author>
    <year>2019</year>
    <price>15.30</price>
  </book>
  <book category="web">
    <title>Learning XML</title>
    <author>Narayan</author>
    <year>2021</year>
    <price>19.90</price>
  </book>
</bookstore>
In the example above :
 
<title>, <author>, <year>, and <price> have text content because they contain text (like 15.30).
 
<bookstore> and <book>have element contents, because they contain elements.
 
<book> has an attribute (category="children").
Advertisement