Change indentation configuration for XML file in Eclipse

If you are using Eclipse, we will sometimes encounter a bug related to setting the size of the indentation for the XML file.

What is that error?

In Eclipse, you try to open Preferences, select XML, select XML Files and then select Editor to change the configuration of the indentation size when using space (Indent using spaces -> Indentation size).

Change indentation configuration for XML file in Eclipse

Sometimes, you will not be able to change the number in this box or press the + or – button. The default value for this cell is 1.

So, how can we change that?

There is a temporary solution for you to find and add to the following line in the .metadata/.plugins /org.eclipse.core.runtime/.settings/org.eclipse.wst.xml.core.prefs file in your workspace.

Here I want the indentation of 2.

Now when you reopen Eclipse, you will see that the default value is 2.

Change indentation configuration for XML file in Eclipse

Add Comment