XML中的嵌套注释? [英] Nested comments in XML?

查看:800
本文介绍了XML中的嵌套注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些嵌套的注释是否允许在XML文件中使用?

 <错误代码 - > 
<! - < component>
<! - 结果观察模板 - >
<! - < id root =2.16.840.1.113883.19.5.10extension =103220/>
< / component> - >

否,字符串 - - 不允许出现在XML中的注释中。因此,你有 - 在另一个评论中出现的事实将导致失败。





要进一步证明,请检查W3C规范:



a href =http://www.w3.org/TR/2008/REC-xml-20081126/#sec-comments =nofollow noreferrer> http://www.w3.org/TR/2008/ REC-xml-20081126 /#sec-comments



短语


为了兼容性,字符串 - (双连字符)不得出现在注释中。]


XML部分的第一段。


Are these nested comments allowed in a XML file?

<!-- Making only one observation attempting to correct the error code -->
<!-- <component>
       <!-- Result observation template -->
            <!-- <id root="2.16.840.1.113883.19.5.10" extension="103220"/>
     </component> -->

解决方案

No, the string -- is not permitted to appear within comments in XML. So the fact you have -- show up inside another comment is going to cause failures.

And trying to post that answer also broke the text entry parsing ;)

For further proof, check the W3C specification:

http://www.w3.org/TR/2008/REC-xml-20081126/#sec-comments

The phrase

For compatibility, the string " -- " (double-hyphen) MUST NOT occur within comments.]

appears in the first paragraph of the section on XML comments.

这篇关于XML中的嵌套注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆