XML注释和“ - ” [英] XML comments and "--"
问题描述
<!-- here is some comment --
^
|
what can be here apart from '>'?
XML似乎不喜欢评论中的 - 。我读的地方,' - '切换一些模式内<! ...>
的东西,但<! - - - - >
> - s)似乎也无效。如果是一些历史特色,什么是亲的一部分呢? (contra部分无法在注释中包含 -
)。
XML seems not to like '--' inside comments. I read somewhere that '--' switchs some modes inside <! ... >
thing, but <!-- -- -- -->
(even number of --
s) seem to be invalid too. If it is some historic feature, what is "pro" part of it? ("contra" part is inability to have --
in comments).
推荐答案
从标准文档:
http://www.w3 .org / TR / REC-xml /#sec-comments
[定义:注释可能出现在文档的任何地方其他
标记;此外,它们可能出现在文档类型
声明中的语法允许的地方。它们不是
文档的字符数据的一部分; XML处理器可以但不必须使得
可能用于应用程序检索评论的文本。 对于
兼容性,字符串 - ] 在
注释中不能识别参数实体引用。
[Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.
这篇关于XML注释和“ - ”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!