Forums

Google XML Sitemaps
[resolved] XML Parsing Error: junk after document element (14 posts)

  1. erebussymk
    Member
    Posted 5 months ago #

    I am getting error like this in my sitemap.

    XML Parsing Error: junk after document element
    Location: http://bikramkawan.com.np/sitemap.xml
    Line Number 2, Column 1:<b>Warning</b>: Invalid argument supplied for foreach() in <b>/hermes/bosweb/web201/b2012/ipg.pri2sh/bikramkawan/wp-includes/query.php</b> on line <b>2746</b>
    ^

    Currently Not generating sitemap for new post. Will this effect in google crawling my old post.

    http://wordpress.org/extend/plugins/google-sitemap-generator/

  2. goss
    Member
    Posted 5 months ago #

    in /wp-includes/query.php change this

    /`/ Always sanitize
    foreach ( $this->posts as $i => $post ) {
    $this->posts[$i] = sanitize_post( $post, 'raw' );
    }`
    to
    /`/ Sanitize before caching so it'll only get done once
    for ( $i = 0; $i < $this->post_count; $i++ ) {
    $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
    }`
    Poor hack I know!

  3. goss
    Member
    Posted 5 months ago #

    // Always sanitize
    		foreach ( $this->posts as $i => $post ) {
    			$this->posts[$i] = sanitize_post( $post, 'raw' );
    		}

    to

    // Sanitize before caching so it'll only get done once
    		for ( $i = 0; $i < $this->post_count; $i++ ) {
    			$this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
    		}
  4. goss
    Member
    Posted 5 months ago #

    in /wp-includes/query.php change this

    // Always sanitize
    		foreach ( $this->posts as $i => $post ) {
    			$this->posts[$i] = sanitize_post( $post, 'raw' );
    		}

    to

    // Sanitize before caching so it'll only get done once
    		for ( $i = 0; $i < $this->post_count; $i++ ) {
    			$this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
    		}
  5. erebussymk
    Member
    Posted 5 months ago #

    Goss,it worked for me. But the url structure in sitemap is
    http://bikramkawan.com.np/sitemap-pt-post-2011-12.xml like this. Previously it look like (with post name)
    http://bikramkawan.com.np/check-hseb-result-20682011-grade11-sciencemanagementhumanites-with-marksheet/

  6. Karesansui
    Member
    Posted 5 months ago #

    I am having this in multiple sites.

    I really do not want to hack the WP code (now on 3.3) of all these sites and get stuck to the maintenance.

    Will there be a plugin fix soon ?
    Thanks,

  7. Arne
    Member
    Posted 5 months ago #

  8. Karesansui
    Member
    Posted 5 months ago #

    I tried it but I am getting lots of 404 in almost al .xml-files.

    How can I force regeneration of the whole lot ?

    Thanks,

  9. Arne
    Member
    Posted 5 months ago #

    There is no regeneration, since they are all generated on the fly. Could you post the URL to a not-working example?

  10. Karesansui
    Member
    Posted 5 months ago #

  11. Arne
    Member
    Posted 5 months ago #

    Your sitemap looks good and passes all online validation tools. Please resubmit it in the Google Webmaster Tools, i guess Google is still reporting the errors because of the previous problems.

  12. Karesansui
    Member
    Posted 5 months ago #

    I did resubmit already. And again.

    I'll give it an other day to see if it is picking up/reporting on ald stuff.

    Thanks,

  13. erebussymk
    Member
    Posted 5 months ago #

    Will it be wise tweaking wp code ?? Will it hamper in future ?

  14. Karesansui
    Member
    Posted 5 months ago #

    Will it be wise tweaking wp code ?? Will it hamper in future ?

    No not clever at all. hence my earlier comment

    I really do not want to hack the WP code (now on 3.3) of all these sites and get stuck to the maintenance.

    Will there be a plugin fix soon ?

    It has been fixed in the beta version.

Reply

You must log in to post.

About this Plugin

About this Topic