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

2

8

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> 
Selftaught answered 14/10, 2016 at 13:39 Comment(2)
Which validator do you use?Guilty
tools.seochat.com/tools/site-validatorSelftaught
G
4

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

Guilty answered 16/10, 2016 at 12:43 Comment(2)
so what online resource is better for validation? Because i have same problems, and not sure that my sitemap is valid. Thanks!Reticulate
@LINKeRxUA: You could ask on Software Recommendations (recommendations are off-topic here on Stack Overflow)Guilty
H
4

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/">

Homophonic answered 19/4, 2017 at 17:37 Comment(2)
This is not correct. XML namespace names are compared "as strings", so appending a slash would describe a different namespace. A namespace name does NOT have to be "usable for retrieval of a schema". The namespace name for XHTML is "http://www.w3.org/1999/xhtml"Finalize
This is not passing any sitemap validators I have found, do you have proof this works?Goa

© 2022 - 2024 — McMap. All rights reserved.