Support » Plugin: XML Sitemap Generator for Google » Sitemap not valid XML due to blank line at the top

  • Hi,

    The plug-in is inserting a blank line at the top of the sitemap XML file, which turns it into invalid XML (the XML spec requires the XML header be on line 1 of the file).

    So, if I try to look at the XML file using a web browser, for example, the browser immediately barfs because it’s not valid XML and so won’t parse correctly.

    Webkit based browsers say:

    “This page contains the following errors:
    error on line 2 at column 6: XML declaration allowed only at the start of the document”

    🙁

    https://wordpress.org/plugins/google-sitemap-generator/

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s probably because of an empty line at the end of your functions.php in the theme. Can also be the same error in a plugin.

    Best thing is to remove ?> at the end of functions.php, that way it can’t happen again.

    Thread Starter ellimerino

    (@ellimerino)

    That was it! I would never have figured that out, so thanks very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sitemap not valid XML due to blank line at the top’ is closed to new replies.