使用Google图像索引验证站点地图

Ode*_*old 1 xml sitemap xsd

我正在尝试 使用此验证工具验证此站点地图:http://animal.org.il/post.xml:http://www.xmlcheck.com/checkurl.php

我得到这个错误上的所有图片:图片每日新闻:错误1845:元素"{http://www.google.com/schemas/sitemap-image/1.1}image":没有匹配的全局元素声明可用,但要求通过严格的通配符.

以下是我的站点地图的当前来源的片段,其中显示了一些图片:图片代码:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://animal.org.il/wp-content/plugins/bwp-google-xml-sitemaps/xsl/bwp-sitemap.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">

<url>
    <loc>http://animal.org.il/to-be-goose/</loc>
    <lastmod>2012-07-24T09:57:18+00:00</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.4</priority>
    <image:image>
      <image:loc>http://animal.org.il/wp-content/gallery/goose/goose-nature.jpg</image:loc>
      <image:title>???? ????</image:title>
      <image:caption>???? ???? ?? ?? ??? ???? ????????? ??? ???, ?? ??????? ???? ??????? ??? ?? ???? ????? ??? ?????.</image:caption>
    </image:image>
    <image:image>
      <image:loc>http://animal.org.il/wp-content/gallery/goose/goose-feathers.jpg</image:loc>
      <image:title>?????? ??????</image:title>
      <image:caption>???? ???? ?????? ?? ???? ????? ???? ????? ???????. ???? ????? ?? ?????? ?&lt;a href="http://anonymous.org.il/cat40.html" target="_blank"&gt;?????&lt;/a&gt; ?? ????????? ??????? (Kalla Fatka, TV4)</image:caption>
    </image:image>
    <image:image>
      <image:loc>http://animal.org.il/wp-content/gallery/goose/goose-foie-gras.jpg</image:loc>
      <image:title>?? ??????? ??? ????</image:title>
      <image:caption>?? ??? ????? &lt;a href="http://anonymous.org.il/cat14.html" target="_blank"&gt;??? ????&lt;/a&gt;, ?????? ?? ????? ??????? ????? ????? ???? ??????.</image:caption>
    </image:image>
  </url>
Run Code Online (Sandbox Code Playgroud)

C. *_*een 10

默认情况下,您使用的验证服务似乎使用http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd中的站点地图架构来验证站点地图文档.该模式具有一个通配符,将符合你的image:image元素,但这些元素在宣布独立的模式文档中http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd的架构,而不是正在使用.正如错误消息所示,所讨论的通配符是一个"严格"通配符,这意味着它匹配的元素必须在模式中声明.

可能有一种方法可以告诉验证者查询图像命名空间的模式文档,但我看不到任何明显的模式.您可以xsi:schemaLocation在站点地图文档中添加属性,因此您的根元素如下所示:

<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  xsi:schemaLocation="
    http://www.sitemaps.org/schemas/sitemap/0.9
    http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
    http://www.google.com/schemas/sitemap-image/1.1
    http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" >
Run Code Online (Sandbox Code Playgroud)

这通常不是告诉模式验证器在何处查找模式的最佳方法,但它通常有效.但是,不是在这种情况下.

另一方面,对于您上传的文档,您使用的验证服务还允许您上载架构文档.如果您只是导入你希望两个模式文档,对地图和地图图像的命名空间,如下图所示,然后将其上传随着你的网站地图模式文档,与图像元素的错误消失.如果您要从Web验证您的站点地图,而不是通过上传它,可能有另一种方法可以让验证者使用正确的模式; 您必须查找文档或询问服务运营商以获取信息.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:import namespace="http://www.sitemaps.org/schemas/sitemap/0.9"
             schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"/>
  <xs:import namespace="http://www.google.com/schemas/sitemap-image/1.1"
             schemaLocation="http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"/>

</xs:schema>
Run Code Online (Sandbox Code Playgroud)

在他们的位置,你有错误抱怨image:caption元素,应该先于,而不是跟随,image:title.修复后,您的站点地图将被识别为有效.