如何验证兼容的XML站点地图?

前端之家收集整理的这篇文章主要介绍了如何验证兼容的XML站点地图?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
对于以下标题,我在所有站点地图上都会遇到相同的两个错误.这很令人困惑,因为如果Google无法读取我的站点地图,那么他们怎么能说每个URL都具有相同的优先级?在 XML声明之后,标头计为第2行. Google声称只会将地图中约2%的网址编入索引.请帮忙.

UPDATE: I think the problem is that I don’t know how to validate against a schema. How to do that?

<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/sitemap.xsd">

==Parsing error
We were unable to read your Sitemap. It may contain an entry we are 
unable to recognize. Please validate your Sitemap before resubmitting.

==Notice
All the URLs in your Sitemap have the same priority...

更新:请耐心等待,第一次验证XML.我不明白这些错误.

Errors in the XML document:
    4:  80  SchemaLocation: schemaLocation value = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' must have even number of URI's.
    4:  80  cvc-elt.1: Cannot find the declaration of element 'urlset'.

XML document:
1   <?xml version="1.0" encoding="UTF-8"?>
2   <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4     xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
5     <url>
6       <loc>http://nutrograph.com/1-butter-salted</loc>
7       <changefreq>monthly</changefreq>
8       <priority>0.8</priority>
9     </url>
10    <url>
11      <loc>http://nutrograph.com/2-butter-whipped-with-salt</loc>
12      <changefreq>monthly</changefreq>
13      <priority>0.8</priority>
14    </url>
15  </urlset>
您是否根据此处给出的模式验证了XML: http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd

如果是,结果是什么?

如果没有,您的站点地图的网址是什么?

如果您不知道如何根据模式验证XML,请使用http://www.xmlvalidation.com/

将sitemap-XML粘贴到那里,单击“验证外部XML模式”并在单击“验证”按钮后粘贴模式.

这将告诉您XML的错误.如果您不知道如何解释结果,请相应修改您的原始问题.

编辑:错误是schemaLocation中缺少namesapce-URL.第一个标签必须如下所示:

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

猜你在找的XML相关文章