Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
Introduction to XML
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. XML document rules
  


Elements can't overlap page 4 of 10


XML elements can't overlap. Here's some markup that isn't legal:


<!-- NOT legal XML markup -->            
<p>
  <b>I <i>really 
  love</b> XML.
  </i>
</p>
          

If you begin a <i> element inside a <b> element, you have to end it there as well. If you want the text XML to appear in italics, you need to add a second <i> element to correct the markup:


<!-- legal XML markup -->
<p>
  <b>I <i>really 
  love</i></b>
  <i>XML.</i>
</p>
          

An XML parser will accept only this markup; the HTML parsers in most Web browsers will accept both.


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact