An “invalid XML” error means a shopping channel (or an XML validator) could not parse your feed file because something in it breaks the rules of well-formed XML. Usually the culprit is a special character or stray markup that leaked in from a product’s title or description. This guide explains what triggers the error, how CTX Feed already protects your feed, and the exact steps to clean any field that still causes trouble.
What makes XML “invalid”
XML has a few characters that carry structural meaning and cannot appear as plain text:
- The ampersand
&, the less-than<, and the greater-than>. - Certain invisible control characters (from copy-pasted content or bad imports) that XML 1.0 does not allow at all.
- Broken or mismatched HTML tags inside a description — for example an unclosed
<div>.
When any of these end up unescaped inside an element, the whole file fails to parse and the channel reports invalid XML.
How CTX Feed already prevents it
For a standard feed, CTX Feed escapes your data automatically as it writes the XML:
- CTX Feed wraps values in a CDATA block, which tells the parser to treat everything inside as literal text. With the Wrap XML values in CDATA setting on (the default), every value is wrapped; with it off, only values that contain a special XML character (
&,<,>) are. This keeps the file valid without altering what shoppers see. - The XML header declares UTF-8 encoding so accented and non-Latin characters are handled correctly.
Because of this, a feed built with a standard CTX Feed template rarely produces invalid XML on its own. The first fix, therefore, is simply to regenerate the feed from Manage Feeds and re-check — an old file from before an update may predate these safeguards.
Clean a field that still breaks the feed
If a specific field (most often the description) still causes an error, add a cleaning transform to it on the Config tab. Each of these is available on the free version, in the row’s Output column:
- Open the feed on CTX Feed → Make Feed (or edit it from Manage Feeds) and go to the Config tab.
- Find the row for the problem attribute — usually description or title.
- In the Output dropdown, tick one or more of these, then regenerate:
- Strip Tags — removes all HTML markup, so broken or unclosed tags can never reach the XML.
- Remove Special Character — strips invalid control characters that XML 1.0 forbids.
- CDATA — force-wraps the value in a CDATA block (belt-and-braces on top of the automatic wrapping).
- Remove ShortCodes — clears leftover
[shortcode]fragments that can carry stray brackets.
For most invalid-XML errors, adding Strip Tags (and, if needed, Remove Special Character) to the description resolves it.
If you use a custom XML template
If your feed uses Custom Template 2 (XML) — which requires CTX Feed Pro — the XML skeleton is authored by you, so a typo there — a misspelled wrapper, a missing closing tag, or an unescaped character in fixed text — will produce invalid XML no matter how clean the product data is. Check that:
- Every opening tag has a matching closing tag.
- The Items wrapper and Single item wrapper names are valid (letters, no spaces).
- Any literal
&,<, or>you typed into the template is written as&,<,>(or wrapped in CDATA).
Switching back to the channel’s standard template is the quickest way to confirm the template — not the data — is the cause.
Validate before you submit
To catch problems before a channel does:
- On Manage Feeds, open the feed’s ⋮ menu → Preview (or open the feed URL) to view the raw XML in your browser. Modern browsers highlight the exact line where XML parsing fails.
- Or paste the feed URL into any online XML validator to see the offending line and character.
- Note the attribute and product it points to, clean that field as above, and regenerate.
Troubleshooting
- The error names a specific line. Open the previewed feed at that line; the product and field there are the source — apply Strip Tags / Remove Special Character to that attribute.
- The whole file won’t open in the browser. That points to a structural problem — most often a custom template issue; verify the wrappers and closing tags.
- Only some products fail. Those products have unusual characters in their data. The cleaning transforms above are applied per attribute, so they fix every product at once — no need to edit products individually.
- It was fine, then broke after adding content. A new product’s description likely contains raw HTML or a pasted control character. Regenerate after adding Strip Tags to the description.
Related guides
- How to remove short codes and HTML tags from product description
- CSV file UTF-8 encoding error
- How to use command to format attribute output
- How to solve WooCommerce structured data issues
