Mega Code Archive

 
Categories / XML Tutorial / Introduction
 

Empty Elements

Sometimes an element has no PCDATA.  <name nickname='007'>      <first>James</first>      <middle></middle <!--James does not have middle name -->  >      <last>Bond</last>  </name>  You can write this element using a self-closing tag:  <middle/>  The / and > always have to be together <middle /> or this  <middle/>  but not like this <middle/ > or this <middle / >  Empty elements are used for elements with no PCDATA but attributes.  <name first="Bond"        middle="James"        last="Last"/>