Go XML: undefined entity 'nbsp' (encoding/xml fixes)
TL;DR: Validate locally, fix the first real error, validate again (no upload).
Fix Go XML: undefined entity 'nbsp' (encoding/xml fixes) with an XML escape-first workflow and local validation (no upload).
XML escape matrix
| Character | Escape | Where it matters most |
|---|---|---|
& | & | Text nodes, attributes, URLs inside XML |
< | < | Text nodes |
> | > | Optional in text; safer in generated markup |
" | " | Attribute values |
' | ' | Attribute values |
Primary rule for this page
Use numeric entity   (or literal Unicode NBSP)
Focus for this query
- XML supports only predefined entities unless a DTD declares custom entities.
- HTML entities like ' ' are not guaranteed in XML parsers without DTD support.
CDATA vs escaping
Use escaping for normal text/attributes. Use CDATA when large literal blocks are easier to keep unchanged.
- Escaping is safest for machine-generated XML fields.
- CDATA is convenient for long snippets, but still requires clean XML structure.
- Never include raw
]]>inside CDATA without splitting/escaping.
Example
<!-- Text node -->
<title>Tom & Jerry</title>
<!-- Attribute value -->
<link href="/search?q=a&b=1" />
<!-- CDATA for rich text -->
<snippet><![CDATA[if (a < b && b > 0) { return a; }]]></snippet>
Fast fix workflow
- Find first parser error line/column.
- Replace reserved character/entity usage at that location.
- Re-validate immediately after each edit.
- Convert/export only when parser reports clean XML.
Common parser signals
- EntityRef: expecting ; — raw
&or incomplete entity. - Undefined entity — entity not declared/unsupported by parser.
- Unescaped ampersand in URL — use
&inside XML.
FAQ
Is anything uploaded to a server? No. All processing happens locally in your browser. Files are never uploaded.
What is the recommended workflow? Validate the input, fix the first real issue, validate again, then export/convert. This avoids compounding errors.
Related tools
Related guides
Privacy & Security
All processing happens locally in your browser. Files are never uploaded.
Related by intent
Closest pages and hubs to accelerate crawl discovery and first impressions.
First impression poolImpression seed hubIntent hub: generalRuntime: goTopic: xmlRelated: go json cannot unmarshal string into field item price type boolRelated: base64url integration edge functions compatibility matrixRelated: base64url api response reliability checksRelated: base64url integration serverless monitoring metrics