小编ble*_*tin的帖子

如何格式化具有长属性列表的 XML 文件?

我目前正在处理包含具有一长串属性的元素的 XML 文件。当我尝试xmllint --format myfile.xml仅使用缩进的元素重新缩进整个 XML 文件时,属性仍然保留在一行中。

是否有一些(命令行、Windows 或 GNU/Linux)程序支持重新格式化 XML,包括属性?

例如像这样的 XML:

<root>
  <node attribute1="some long attribute value" attribute2="some long attribute value" attribute3="..."/>
</root>
Run Code Online (Sandbox Code Playgroud)

应该输出类似于:

<root>
  <node attribute1="some long attribute value"
        attribute2="some long attribute value"
        attribute3="..."/>
</root>
Run Code Online (Sandbox Code Playgroud)

xml indentation command-line

8
推荐指数
1
解决办法
6101
查看次数

标签 统计

command-line ×1

indentation ×1

xml ×1