Eclipse, How to activate Folding in XML file? Eclipse, How to activate Folding in XML file? xml xml

Eclipse, How to activate Folding in XML file?


Eclipse Mars (4.5.1)

  1. XML file having the .xml extension

    Just edit / open the file and the folding option will be available:

    enter image description here

    But if you disable and then enable the folding from right click on the left side bar:

    enter image description here

    there is a bug: folding won't be available.

    Workaround: change the tab to another file and then come again to the previous tab. The icons will be back.

    enter image description here

  2. XML file having a different extension (E.g.: .xaml)

    You can try to open the file using the XML Editor from the right click:

    enter image description here

    enter image description here

    and if it fails, just add the file extension to the XML (Illformed) from Window > Preferences > General > Content Types:

    enter image description here

    enter image description here

    enter image description here


I use Eclipse-Java EE Juno. XML folding is enabled by default and icons can be seen. But after disable and enabling the "Enable Folding" option, folding icons are not seen. Seems to be a bug in Eclipse. Workaround could be after enabling the option, try to add a new tag (may be dummy one). Then folding icons can be seen.


Answering 3 years too late but google brings me here, I guess my answer can still be useful :)

The native xml editor from eclipse is able to fold/unfold xml. Neat. This is not the case for the android xml editor (coming with the ADT plugin I guess).

If you need folding for an android xml file, just right-clic on it, open with, XML Editor. This will use eclipse's xml editor, with folding functionality.