站点地图(XML)验证问题

发布于 2024-09-28 03:12:37 字数 1052 浏览 5 评论 0原文


在为我的网站构建站点地图时,我遵循了以下网站中指定的站点地图标准。
1.http://www.wordsinarow.com/xml-sitemaps.html
2.谷歌站长中心: 3.站点地图协议:

站点地图以XML格式生成并发布到网站http://validator.w3.org/< /a> 用于验证。 用于验证站点地图的两种输入方法是通过文件上传验证和通过直接输入验证 在这两种方法中,站点地图 XML 文件都通过了作为格式良好的 XML 文档的所有测试,但站点提出了 2 个警告,如下所示:

未找到 DOCTYPE!仅检查 XML 语法。
DOCTYPE 声明无法识别或丢失。这可能意味着正式公共标识符包含拼写错误,或者声明未使用正确的语法,或者您的 XML 文档未使用 DOCTYPE 声明。 已跳过文档验证,而是执行了对 XML 语法格式良好性的简单检查。

如果我们想在 xml 站点地图中添加 doctype,如 http://validator.w3.org/docs/help.html#faq-doctype 中指定的,该文档需要采用 XHTML 格式,如下所示,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>

      <title>Title</title>
    </head>

    <body>
      <!-- ... body of document ... -->
    </body>

  </html>

如果有的话请指导我我应该继续寻找解决方案的其他方向。

I have followed the sitemap standards specified in the following sites while building the sitemap for my site.
1.http://www.wordsinarow.com/xml-sitemaps.html
2.The google webmaster central:
3.Sitemap protocol:

The sitemaps are generated in XML format and posted to the website http://validator.w3.org/ for validation.
The two input methods used for validating a sitemap are Validate by File Upload and Validate by direct input
In both the methods the sitemap XML file passes all the tests for being a well-formed XML document but the site raises 2 warnings which are as below,

No DOCTYPE found! Checking XML syntax only.
The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax, or that your XML document is not using a DOCTYPE Declaration.
Validation of the document has been skipped, and a simple check of the well-formedness of the XML syntax has been performed instead.

If we want to add the doctype in the xml sitemap as specified inhttp://validator.w3.org/docs/help.html#faq-doctype the document needs to be in XHTML format as below,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>

      <title>Title</title>
    </head>

    <body>
      <!-- ... body of document ... -->
    </body>

  </html>

Please guide me if there is any other direction in which I should proceed to find the solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谁人与我共长歌 2024-10-05 03:12:37

W3C 验证器不验证 XML。尝试在 Web 浏览器中打开 XML 文件,您会发现任何验证错误。

The W3C validator doesn't validate XML. Try opening the XML file in a web browser and you'll discover any validation errors that way.

紫罗兰の梦幻 2024-10-05 03:12:37

您无需将网站提交给 W3C 验证器,因为它无论如何都不验证 XML(XML 与 XHTML 不同)。您可以使用网络浏览器打开 XML 文件来查看任何错误(或者尝试这个 XML 验证器这个

最好的方法是将您的 XML 提交给 Google 网站管理员,看看 Google 是否接受它,否则它会告诉您站点地图中有错误。站点地图 xml 的更完整定义显示在 http://www.sitemaps.org/protocol.php< /a>.

如果您在手动创建站点地图时遇到问题,请尝试使用免费的在线生成器来帮助您入门(然后手动修改创建的 XML): http://www.xml-sitemaps.com/

You do not need to submit your site to the W3C validator as it doesn't validate XML anyways (XML is different than XHTML). You can open the XML file with your webbrowser though to see any errors (or try this XML validator or this one)

The best way is just to submit your XML to Google Webmaster and see if Google accepts it, otherwise it will tell you that there are errors in your sitemap. A more complete definition of the sitemap xml is shown on http://www.sitemaps.org/protocol.php.

If you have problems creating the sitemap manually try a free online generator to get you started (and modify the created XML manually afterwards): http://www.xml-sitemaps.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文