python - 订购 Xml
问题描述
我有一个 xml,它在和没有适当缩进的标签之间有空格。如何重新排序它..?
我想要的输出是正确缩进的 XML 文档,中间没有空行
<Document>
<another>
<tag1>
<content>a</content> <!-- might be other nested tags inside <content></content>-->
<content>b</content> <!--might be other nested tags inside <content></content>-->
<content>c</content> <!--might be other nested tags inside <content></content>-->
</tag1>
<tag_b>
<things>d</things> <!--might be other nested tags inside <things></things>-->
<things>e</things> <!--might be other nested tags inside <things></things>-->
<tag_C>
<!-- other nested tags here -->
</tag_C>
</tag_b>
<tag_b>
<things>f</things> <!--might be other nested tags inside <things></things>-->
<things>g</things> <!--might be other nested tags inside <things></things>-->
<tag_C>
<!-- other nested tags here -->
</tag_C>
</tag_b>
<tag_b>
<things>f</things> <!--might be other nested tags inside <things></things>-->
<things>g</things> <!--might be other nested tags inside <things></things>-->
<tag_C>
<!-- other nested tags here -->
</tag_C>
</tag_b>
</another>
解决方案
推荐阅读
- javascript - Material-UI - 范围滑块中的拇指切换样式
- javascript - HTML 单选按钮操作 - 打开输入
- monitoring - 使用 zabbix 进行 Check Point 防火墙监控
- ios - 如何在 iOS 上嵌入用户凭据以供 ArcGIS 运行时 SDK 访问门户?
- node.js - Snowflake NodeJS Driver SELECT .... WHERE id IN (??) 子句
- assembly - 强制 gcc 将所有代码放在序言和结尾之间
- arrays - 带数组的重载赋值运算符
- sql - ORACLE 从 url 读取文件
- javascript - 在发送到客户端之前,如何从 Parse 服务器访问和消毒我的 Javascript 用户对象?
- java - 带网关的 CORS