如何使 XML 文件始终在文本编辑器而不是 XML 编辑器中打开?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6915849/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 14:52:31  来源:igfitidea点击:

How to make XML files always open in the text editor rather than the XML editor?

xmleclipseeditor

提问by Aubergine

I went to file associations there was no .xmlformat, when I added it, all editors were added automatically and they are static writing me something like:

我去了文件关联,那里没有.xml格式,当我添加它时,所有编辑器都是自动添加的,它们是静态的,写给我类似的东西:

locked by 'XML' content type

...can't remove association.

...无法删除关联。

I want that whenever I create an XML file, it would be opened automatically with the text editor.

我希望每当我创建一个 XML 文件时,它都会被文本编辑器自动打开。

Please help.

请帮忙。

回答by

enter image description here

在此处输入图片说明

Click default on *.xml and Text editor

在 *.xml 和文本编辑器上单击默认值

Close all files and then try to open an XML file again.

关闭所有文件,然后再次尝试打开 XML 文件。

回答by Mr_and_Mrs_D

My problem was that I opened the pom.xml with the maven editor - I wanted it to be opened with the maven editor but to open in the "source" view - achieved it by:

我的问题是我用 maven 编辑器打开了 pom.xml - 我希望它用 maven 编辑器打开但在“源”视图中打开 - 通过以下方式实现:

enter image description here

在此处输入图片说明

Typing xml in the search box did not include this page in the results.

在搜索框中键入 xml不会在结果中包含此页面

回答by mGamma

For people who are looking for a simple text based XML editor, the default XML editor in Eclipse comes with a text based view with syntax highlighting (as it should). It's just not intuitive to know this view exists.

对于正在寻找简单的基于文本的 XML 编辑器的人来说,Eclipse 中的默认 XML 编辑器带有一个基于文本的视图,并带有语法突出显示(应该如此)。知道这个视图存在并不直观。

  • After you open the file with "XML Editor" the text view can be toggled by clicking on the "Source" tab on the bar just below the file.
  • 使用“XML 编辑器”打开文件后,可以通过单击文件下方栏上的“源”选项卡来切换文本视图。

By default the view is "Design". "Source" is the simple text based view with syntax highlighting.

默认情况下,视图为“设计”。“Source”是带有语法高亮显示的简单文本视图。

For a much better illustration, see:

有关更好的说明,请参阅:

How do I view xml in Eclipse with simple syntax highlighting?

如何使用简单的语法突出显示在 Eclipse 中查看 xml?