xmlParseEntityRef: no name
A bare ampersand (&) in text or an attribute.
The message, as the validator reports it
xmlParseEntityRef: no name
Why it happens
- Text such as Smith & Sons or a URL with a query string (
?a=1&b=2) written into XML without escaping. - XML built by joining strings instead of with an XML library, which would have escaped it.
How to fix it
Write & for every ampersand that is not the start of an entity. When the XML is generated by code, use a serializer or the language's escaping function rather than string concatenation; or wrap literal text in <![CDATA[ … ]]>.
Example
Reports the error
<company>Smith & Sons</company>
Fixed
<company>Smith & Sons</company>