在一行中添加大型 XML 文件中的换行符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11779855/
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 13:38:11  来源:igfitidea点击:

Add line breaks in large XML file in one line

xmlnotepad++

提问by asmundur

I have a large XML file in one line.

我在一行中有一个大的 XML 文件。

How can I add a line break for each tag so that it is not in one line in my editor?

如何为每个标签添加换行符,使其不在我的编辑器中的一行中?

I am using notepad ++

我正在使用记事本++

Thanks in advance

提前致谢

回答by Icarus

From the menu , go to

从菜单中,转到

Plugins --> XML Tools --> Pretty Print 

If you don't have the XML tools plugin installed, you can download it by clicking on

如果您没有安装 XML 工具插件,您可以点击下载

Plugins --> Show Plugin Manager 

And choosing XML Tools

并选择 XML 工具

回答by Ganton

Perhaps that will be useful to someone:

也许这对某人有用:

How can I add a line break for each tag so that it is not in one line in my editor?

如何为每个标签添加换行符,使其不在我的编辑器中的一行中?

To do that to several files, automatically, I use XmlLint:

要自动对多个文件执行此操作,我使用 XmlLint:

xmllint YOUR_FILE.xml --format

xmllint YOUR_FILE.xml --format

XmlLint is available in the Kubuntu/Ubuntu packages, and also can be downloaded for several operating systems in: ftp://xmlsoft.org/libxml2/

XmlLint 在 Kubuntu/Ubuntu 包中可用,也可以在以下几个操作系统下载:ftp: //xmlsoft.org/libxml2/

回答by Monsif EL AISSOUSSI

instead of of doing this : Plugins --> XML Tools --> Pretty Print , you can use this usefull shortcut : Ctrl + Alt + shift + B

而不是这样做:插件 --> XML 工具 --> 漂亮的打印,你可以使用这个有用的快捷方式: Ctrl + Alt + shift + B