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.
| Parser | Message |
|---|---|
| libxml2 / xmllint | Document is empty |
| Chrome DOMParser | error on line 1 at column 1: Document is empty |
| Python ElementTree | no 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
<?xml version="1.0"?>
<!-- nothing here yet --><?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.
Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.