Search code examples
xmlfeed

XML feed does not validate, but syntax seems to be correct?


My XML feed for Trulia found here doesn't seem to render correctly. But upon inspection all tags appear to be correctly nested and I don't see any errors with syntax.

W3C's feed validator outputs this report, saying that the feed isn't well-formed, but it seems correctly formed to me?

column 39: Undefined root element: properties 
column 35473: XML parsing error: <unknown>:1:35497: not well-formed (invalid token)

Solution

  • Escaping illegal characters by wrapping them with CDDATA in the format <![CDATA[foo]]> cleared one of the issues, however this wasn't the only reason my feed wasn't being read.

    The problem was that the MIME type for the feed was text/html instead of xml. I checked the MIME types configured on my server and saw no issues however.

    I later discovered that it was a caching issue caused by a Wordpress plugin that operates in the same directory. By excluding that file in W3 Total Cache's whitelist the feed rendered correctly.