Commenting out XML

霸气de小男生 提交于 2019-12-04 04:20:14

问题


Consider this piece of XML:

<ListBox x:Name="pictureBox"
                ItemsSource="{Binding}"
                 MouseDoubleClick="item_DoubleClick"
>

Is there any way to comment out MouseDoubleClick="item_DoubleClick"? This attempt fails:

<ListBox x:Name="pictureBox"
                ItemsSource="{Binding}"
                <!-- MouseDoubleClick="item_DoubleClick"-->
>

回答1:


You could just comment out the whole element, which would work, and underneath it put the modified version without that attribute.




回答2:


No it's not you'll have to remove it. You cannot have comments inside the declaration of an Element. It would not be possible for the parser to parse this XML at all because of the additional "<" sign inside the open declaration of ListBox Element.



来源:https://stackoverflow.com/questions/5244187/commenting-out-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!