我目前正在处理包含具有一长串属性的元素的 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)