【问题标题】:Errror: INCORRECT NAMESPACE in Custom Sitemap Structure错误:自定义站点地图结构中的名称空间不正确
【发布时间】:2018-10-09 17:19:34
【问题描述】:

我想为我的站点创建自定义站点地图:https://adaway.info ,问题是当我写完整个东西时,它给出了Incorrect Namespaces on a number of lines的错误。

谁能解释如何摆脱这个?

(PS:为方便起见,我现在使用的是 yoast 站点地图,但我真的在寻找自定义站点地图。)

【问题讨论】:

    标签: sitemap.xml


    【解决方案1】:

    您必须非常小心,以确保架构和位置与此完全相同:

    http://www.sitemaps.org/schemas/sitemap/0.9 - 我曾经有过
    http://www.sitemaps.org/schemas/sitemap/0.9
    它返回了与您收到的相同的错误。看看你是否能发现尾随的空格。

    这是一个使用 SimpleXML 的示例:

    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><urlset></urlset>');
    $xml->addAttribute('xmlns','http://www.sitemaps.org/schemas/sitemap/0.9');
    $xml->addAttribute('xmlns:xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
    $xml->addAttribute('xmlns:xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd');
    

    【讨论】:

      猜你喜欢
      • 2022-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-05
      • 2011-05-13
      相关资源
      最近更新 更多