从xml文件中删除注释并进行漂亮打印 [英] strip comments from xml file and pretty-print it

查看:72
本文介绍了从xml文件中删除注释并进行漂亮打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个巨大的xml文件,其中包含很多注释.

I have this huge xml file which contains a lot of comments.

去除所有注释并从linux命令行很好地格式化xml的最佳方法"是什么?

Whats the "best way" to strip out all the comments and nicely format the xml from the linux command line?

推荐答案

您可以使用整洁的

$ tidy -quiet -asxml -xml -indent -wrap 1024 --hide-comments 1 tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <user username="qwerty" password="ytrewq" roles="manager-gui" />
</tomcat-users>

这篇关于从xml文件中删除注释并进行漂亮打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆