如何配置Eclipse XML格式? [英] How to configure Eclipse XML formatting?
问题描述
我想改变Eclipse格式的XML文件的方式。例如,如果我在pom.xml文件中有一个部分,如下所示:
I would like to change the way Eclipse formats XML files. For example, if I have in pom.xml file a section as follows:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
在ctrl + shift + f之后,它将如下所示:
After ctrl+shift+f it will look like:
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
3.8.1
</version>
<scope>
test
</scope>
</dependency>
我更喜欢第一个版本,那么如何配置Eclipse来格式化XML文件呢? / p>
I prefer the first version, so how to configure Eclipse to format XML files to look like that?
推荐答案
窗口 - >首选项,然后是XML - > XML文件 - >编辑器。在首选项树上方有一个搜索框,当您想要查找配置的位置时,非常有用。
Window -> Preferences, then XML -> XML Files -> Editor. There is a search box above the preferences tree, very useful when you want to find where something is configured.
请注意,它可能是其他一些编辑器,例如如果您正在编辑 build.xml
文件并具有Ant集成。在这种特定情况下,您可以在Window - > Preferences,Ant - > Editor - > Formatter中设置格式。在类似的情况下,您需要自己搜索该编辑器的相应选项。
Note that it may be some other editor is used, e.g. if you're editing a build.xml
file and have the Ant integration. In this specific case you'd set up the formatting at Window -> Preferences, Ant -> Editor -> Formatter. In similiar cases you need to search for the corresponding options for that editor yourself.
这篇关于如何配置Eclipse XML格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!