【发布时间】:2014-09-09 15:31:30
【问题描述】:
在我的 XHTML 文档中,nxml-mode(通过其包含的 XHTML Relax NG 紧凑模式)将 usemap 属性的值标记为错误 @ 987654324@.
<img src="sample_image.png"
usemap="#sample_image_map"
alt="Sample Image"
border="0" />
问题似乎是usemap 属性的值中存在前导# 字符。如果我删除 # 字符,nxml-mode 表示该值有效。但是前导 # 字符通常应出现在 usemap 的值中,这通常用于引用文件中其他位置的 map 定义。
nxml-mode 是否在usemap 的值上错误地引发了验证错误?
(请注意,我使用的是 Emacs 24.2.1 及其包含的 nxml-mode 版本。)
这是一个完整的 XHTML 示例,在 the W3C validator 验证:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>nxml-mode Validation Problem</title>
</head>
<body>
<!-- The '#' is OK here. -->
<a href="#sample_link">Sample Link</a>
<map id="sample_image_map">
<area shape="poly" coords="100,0, 200,0, 200,50, 100,50"
alt="Sample Area"/>
</map>
<!--
* For the value of the 'usemap' attribute, 'nxml-mode'
* issues the error 'Attribute value invalid'.
*
* However, if the '#' is removed from the value
* '#sample_image_map', 'nxml-mode' indicates the value
* is valid.
-->
<img src="sample_image.png"
usemap="#sample_image_map"
alt="Sample Image"
border="0" />
</body>
</html>
【问题讨论】:
标签: xml validation emacs xhtml relaxng