XML error reference · XV008
Undeclared namespace prefix
A prefix is used on an element or attribute without a matching xmlns declaration in scope.
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 | Namespace prefix soap on Body is not defined |
| Firefox DOMParser | XML Parsing Error: prefix not bound to a namespace |
| .NET XmlException | 'soap' is an undeclared prefix. |
What causes it
A prefix such as `soap:` is only meaningful once it has been bound to a namespace URI by an `xmlns:soap="..."` declaration on the element itself or on an ancestor, and that binding is scoped to the subtree. The usual cause is copying a fragment out of a larger document and leaving the declaration behind on the original root element.
See it happen
<Envelope>
<soap:Body/>
</Envelope><Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body/>
</Envelope>How to fix it
Add the `xmlns:prefix="URI"` declaration, normally on the root element. The prefix itself carries no meaning, only the URI it is bound to, so you may choose any prefix as long as it is declared and used consistently.
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.