9

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>
CrimsonX
  • 9,048
  • 9
  • 41
  • 52

4 Answers4

6

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.

Community
  • 1
  • 1
CrimsonX
  • 9,048
  • 9
  • 41
  • 52
  • try the extension I mention it take comments like that - and makes them like normal c# #region #endregion it's awesome I couldn't live without it. – MemeDeveloper Mar 26 '16 at 21:27
5

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?

MemeDeveloper
  • 6,457
  • 2
  • 42
  • 58
  • Is there anything like this for 2008? I have to use it for some projects – lathomas64 Aug 22 '13 at 16:35
  • Not as far as I know, they list 2013, 2012, 2010. However think there's tricks to use newer extensions in older VS (but maybe that was the other way round i.e. older extension inside newer VS). – MemeDeveloper Nov 18 '13 at 16:06
  • @lathomas64 think you can certainly try it - roughly speaking unzip the visx file (it is a zip really) and in there there's a metadata file with applicable version numbers in it - you can mod that, and give it a go - might work who knows. – MemeDeveloper Mar 26 '16 at 21:25
2

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?

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 5
    The reason why I need this is because we are using XML to create a domain specific language, and there are over ten 15-line structures I'd like to "group" together in one section of a file like a region. I cannot merely add an additional XML tag for this without having the domain specific language changed (I do not have control over this) – CrimsonX Jun 09 '10 at 19:01
  • @CrimsonX - You can always add visual separation in the form of white space. If it is between elements you can add new lines. – Oded Jun 09 '10 at 19:23
  • .. thats effectively what I ended up doing. Just adding `` and `` to show clear descriptions of data. Not collapsable, but good enough. – CrimsonX Jun 09 '10 at 19:56
  • @Oded you CAN just use whitespace, but... Carpal tunnel from scrolling through even more lines than you need... there's got to be a better way no? – MemeDeveloper Jun 10 '13 at 02:54
  • @CrimsonX try the extension I mention above it take comments like that - and makes them like normal c# #region #endregion it's awesome I couldn't live without it. – MemeDeveloper Mar 26 '16 at 21:27
2
<!--region product colors-->
<color name="green_008060">#008060</color>
<color name="green_trans_40_percent_008060">#66008060</color>
<!--endregion product colors-->
Lucas B.
  • 489
  • 5
  • 15