XML error reference · XV004

Document is empty

The input contains no element at all.

What your parser calls it

The same problem, reported differently by each parser. If you arrived here from one of these strings, you are in the right place.

ParserMessage
libxml2 / xmllintDocument is empty
Chrome DOMParsererror on line 1 at column 1: Document is empty
Python ElementTreeno element found: line 1, column 0

What causes it

The parser reached the end of the input without finding a root element. Usually the input is empty or whitespace-only, but it also happens when a fetch returned a zero-length body, when a variable holding the XML was never assigned, or when the file contains only an XML declaration or comments.

See it happen

Triggers the error
<?xml version="1.0"?>
<!-- nothing here yet -->
Corrected
<?xml version="1.0"?>
<!-- nothing here yet -->
<root/>

How to fix it

Confirm the input actually contains XML. If it comes from an HTTP response, check the status code and the response body separately. An empty body with a 200 status is a common cause. A document needs at least one element.

Fix your own document

Paste your own document below. Press Sample if you want the broken example above loaded instead. Nothing you paste leaves this tab.

XML Validator

Well-formedness and schema validation. Nothing is uploaded.

Input
WaitingPaste a document to check it. Validation runs as you type.

Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.

Tools that catch this

Background reading

Errors this fixes

Every XML error, explained