这里是W3C HTML检查器(验证器)的维护者。
要检查的文件对XHTML1模式,你需要发送:
- 的
schema
查询参数与价值http://s.validator.nu/xhtml10/xhtml-strict.rnc
- 一个
Content-Type
标头值application/xhtml+xml; charset=utf-8
例如,使用curl
发送请求,它看起来像这样:
curl -H "Content-Type: application/xhtml+xml; charset=utf-8" \
--data-binary @FILE.xhtml \
'https://validator.w3.org/nu/?schema=http://s.validator.nu/xhtml10/xhtml-strict.rnc&out=json'
...其中FILE.xhtml
将替换为您要检查的实际文件的名称,而out=json
查询参数指定您需要来自检查器的JSON格式的结果。 (使用out=xml
如果你想要XML格式的结果,或out=gnu
在GNU格式错误的结果。)
http://s.validator.nu/xhtml10/xhtml-strict.rnc
仅仅是一个标识符检查内部确认为XHTML 1.0严格的模式。该网址上没有实际的网络架构。
这些标识符的是,检查确认是在下面的文件列表:
https://github.com/validator/validator/blob/master/resources/presets.txt
请注意,您可以通过添加其他标识将schema
值包括一些额外的检查:
curl -H "Content-Type: application/xhtml+xml; charset=utf-8" \
--data-binary @FILE.xhtml \
'https://validator.w3.org/nu/?schema=http://s.validator.nu/xhtml10/xhtml-strict.rnc%20http://s.validator.nu/html4/assertions.sch%20http://c.validator.nu/all-html4/&out=json'
模式标识符必须用%20
(百分比编码的空格字符)分隔。
你发送什么内容类型? –