Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple language sitemap gives validation error "No matching global element declaration available"

I have been trying to follow Google's recommendation for multi-lingual sitemaps. However when I try this on my site I get the error:

Error 1845: Element '{http://www.w3.org/1999/xhtml}link': No matching global element declaration available, but demanded by the strict wildcard.

Even when I paste Google's example into the sitemap validator I get the same error. Is there something I am missing here?

Here is Google's example I've been pasting into the validator:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>http://www.example.com/english/</loc>
    <xhtml:link 
                 rel="alternate"
                 hreflang="de"
                 href="http://www.example.com/deutsch/"
                 />
    <xhtml:link 
                 rel="alternate"
                 hreflang="de-ch"
                 href="http://www.example.com/schweiz-deutsch/"
                 />
    <xhtml:link 
                 rel="alternate"
                 hreflang="en"
                 href="http://www.example.com/english/"
                 />
  </url>

  <url>
    <loc>http://www.example.com/deutsch/</loc>
    <xhtml:link 
                 rel="alternate"
                 hreflang="en"
                 href="http://www.example.com/english/"
                 />
     <xhtml:link 
                 rel="alternate"
                 hreflang="de-ch"
                 href="http://www.example.com/schweiz-deutsch/"
                 />
     <xhtml:link 
                 rel="alternate"
                 hreflang="de"
                 href="http://www.example.com/deutsch/"
                 />
  </url>

  <url>
    <loc>http://www.example.com/schweiz-deutsch/</loc>
     <xhtml:link 
                 rel="alternate"
                 hreflang="de"
                 href="http://www.example.com/deutsch/"
                 />
     <xhtml:link 
                 rel="alternate"
                 hreflang="en"
                 href="http://www.example.com/english/"
                 />
<xhtml:link 
                 rel="alternate"
                 hreflang="de-ch"
                 href="http://www.example.com/schweiz-deutsch/"
                 />
  </url>

</urlset> 
like image 812
pocockn Avatar asked Oct 14 '16 13:10

pocockn


2 Answers

It seems the validator you use, http://tools.seochat.com/tools/site-validator/, doesn’t support additional namespaces (like xhtml in your example).

like image 87
unor Avatar answered Sep 21 '22 12:09

unor


Add a / at the end of your xhtml namespace definition like this:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml/">

like image 45
user2111922 Avatar answered Sep 20 '22 12:09

user2111922