Un esempio di documento XML


  <exam paper="cs203">
    <student>
      Fred Smith
    </student>
    <qapair>
      <question>Who is the last King of England</question>
      <answer>George VI</answer>
    </qapair>
    <qapair>
      <question>How many queens were named Elizabeth </question>
      <answer>Two</answer>
    </qapair>
  </exam>

I tag possibili sono definiti da una DTD (Document Type Definition)