XML error reference · XV022
Invalid character reference
A numeric character reference points at a code point XML 1.0 does not allow.
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 | xmlParseCharRef: invalid xmlChar value 0 |
| .NET XmlException | ',', hexadecimal value 0x00, is an invalid character. |
What causes it
XML 1.0 permits only tab, newline, carriage return and the ranges from U+0020 upward. Most C0 control characters cannot appear in a document at all, and crucially cannot be rescued by escaping them: `�`, `` and `` are all illegal however they are written. Surrogate code points and U+FFFE and U+FFFF are also excluded.
See it happen
<data>value�</data><data encoding="base64">dmFsdWUA</data>How to fix it
Strip the control character at the source. If you must round-trip arbitrary bytes through XML, encode the payload, and base64 is the usual choice, rather than trying to escape it. XML 1.1 relaxes this rule, but its adoption is so thin that switching versions creates more problems than it solves.
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.