Extra content at the end of the document

Something follows the root element, which must be the last thing in the document.

The message, as the validator reports it
Extra content at the end of the document

Why it happens

  • Two root elements: an XML document has exactly one. Concatenated files or a list of records without a wrapper look like this.
  • Text or a stray tag after the root's end tag.
  • An end tag for the root that appears too early, so what follows is outside it.

How to fix it

Wrap several elements in one root element, or split the file into one document per root. Comments and processing instructions may follow the root; elements and text may not.

Example

Reports the error
<note/>
<note/>
Fixed
<notes>
  <note/>
  <note/>
</notes>