这些嵌套注释是否允许在XML文件中?
<!-- 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> -->
Run Code Online (Sandbox Code Playgroud)
Bre*_*ode 53
不,--不允许字符串出现在XML的注释中.因此,您--在另一条评论中显示的事实将导致失败.
并试图发布该答案也打破了文本条目解析;)
有关进一步证明,请查看W3C规范:
http://www.w3.org/TR/2008/REC-xml-20081126/#sec-comments
词组
为了兼容性,字符串" - "(双连字符)不得出现在注释中.]
出现在关于XML注释的部分的第一段中.
psy*_*ave 31
正如我在如何评论XML中的标签块一样?,您可以尝试使用不存在的处理指令包装代码,例如:
<?ignore
<component>
<!-- Result observation template -->
<!-- <id root="2.16.840.1.113883.19.5.10" extension="103220"/>
</component>
?>
Run Code Online (Sandbox Code Playgroud)
Notepad++ 与插件 XML Tools 一起可以做到这一点。
选择一个 xml 块,然后在 xml 工具子菜单上选择“注释选择”。
每个现有的“内部 xml 注释”都将被更改,使其看起来像这样
<!{1}** inner xml comment **{1}>
Run Code Online (Sandbox Code Playgroud)
如果您以这种方式添加另一个外部注释,那些原始内部注释将进一步更改为
<!{2}** inner xml comment **{2}>
Run Code Online (Sandbox Code Playgroud)