验证站点地图文档

时间:2012-02-08 16:03:24

标签: xml xsd sitemap xml-validation

我正在尝试验证this sitemap file。当我在IDE中验证它时,我收到错误:

External resource http://www.sitemaps.org/schemas/sitemap/0.9 is not registered

我还使用an online validator验证了它,这会产生大量错误。我查看了文档,看不出有什么不妥。

1 个答案:

答案 0 :(得分:1)

我发现您的站点地图存在两个问题。

首先 - <lastmod>的值无效。在您的时间值中,架构期望秒。此外,时区指示符缺少冒号。

示例 -

这:<lastmod>2012-02-08T16:32+0000</lastmod>

应该是:<lastmod>2012-02-08T16:32:00+00:00</lastmod>


第二次 - <lastmod>的位置不正确。根据架构,订单必须是:<loc><lastmod><changefreq>,然后是<priority>

示例 -

此:

  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/7</loc>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
  </url>

应该是:

  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/7</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>

以下是修复的sitemap.xml的完整副本:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/</loc>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/privacy</loc>
    <changefreq>weekly</changefreq>
    <priority>0.1</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/terms</loc>
    <changefreq>weekly</changefreq>
    <priority>0.1</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/about</loc>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/artist/show/1</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.5</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/artist/show/2</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.5</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/1</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/2</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/3</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/4</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/5</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
  <url>
    <loc>http://summer-festivals.cloudfoundry.com/festival/show/7</loc>
    <lastmod>2012-02-08T16:32:00+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
  </url>
</urlset>