How to organize xml data using equivalent to #region / #endregion (outlining) from C# .NET

混江龙づ霸主 提交于 2019-12-23 07:38:50

问题


I'd like to organize my XML data to be collapsable and expandable using a preprocessor command like the #region/#endregion command in C#/.NET. I'm editing this file Visual Studio 2008.

Does any such ability exist? I've googled to no avail. The closest I can come to so far is to expand and collapse the tags themselves, so I can collapse between

<Data> 
(this is collapsed)
</Data>

回答1:


There does not appear to be any Visual Studio supported ability to do what I'm looking to do. As discussed in Oded's answer, the best solution was to add XML comments like

<!--START [enter description]--> 
<myDataHere .../>
<!--END [enter description]--> 

with Whitespace to organize the code.




回答2:


if you have VS 2010 + then the fantastic extension here is your best new friend. http://visualstudiogallery.msdn.microsoft.com/3c534623-bb05-417f-afc0-c9e26bf0e177/view/Reviews If not ;( upgrade?




回答3:


Using such commands would change the XML file itself, so I can't see a real use case for this and as you said, you can collapse the tags themselves, so you already have a close to perfect solution to your problem. Why do you need more then that?




回答4:


<!--region product colors-->
<color name="green_008060">#008060</color>
<color name="green_trans_40_percent_008060">#66008060</color>
<!--endregion product colors-->


来源:https://stackoverflow.com/questions/3008900/how-to-organize-xml-data-using-equivalent-to-region-endregion-outlining-fr

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