【问题标题】:W3C validation errorsW3C 验证错误
【发布时间】:2014-07-15 18:36:49
【问题描述】:

我收到几个关于使用 drupal 的网站的验证错误,来自页面的这一部分:

<html lang="en" dir="ltr"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head>

以下验证错误:

Line 11, Column 48: Attribute xmlns:content not allowed here.
Line 11, Column 48: Attribute xmlns:dc not allowed here
Line 11, Column 48: Attribute xmlns:foaf not allowed here.
Line 11, Column 48: Attribute xmlns:og not allowed here.
Line 11, Column 48: Attribute xmlns:rdfs not allowed here.

等等……

有人曾在 drupal 或任何其他网站上体验过这种情况吗?

【问题讨论】:

  • 您应该指定您要验证的 HTML 版本。
  • HTML5 但看起来页面正在使用一些 xml

标签: html validation drupal


【解决方案1】:

从症状来看,您似乎正在针对 HTML5 进行验证,可能使用了&lt;!DOCTYPE html&gt;。 W3C 验证器根据 HTML 序列化规则(HTML 语法)进行验证,其中 xmlns:content 等属性无效。没有命名空间的概念,因此属性名称中的任何: 只是又一个没有特殊含义的字符,此类名称尚未定义。

使用http://validator.nu/,您可以在“预设”下拉列表中选择HTML5 的XML 序列化,即XHTML5。然后你需要遵循所有的 XML 规则以及 HTML5 规则,并且你需要在&lt;html&gt; 标签中包含属性xmlns="http://www.w3.org/1999/xhtml"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    相关资源
    最近更新 更多