【发布时间】:2014-01-17 22:14:54
【问题描述】:
我的代码恰好是这样的:
<project>
<target>
<for list = ... >
<if>
<not>
</not>
<then>
<fail>
</fail>
</then>
</if>
</for>
</target>
</project>
我希望将其格式化为如下所示:
<project>
<target>
<for list = ... >
<if>
<not>
</not>
<then>
<fail>
</fail>
</then>
</if>
</for>
</target>
</project>
我考虑过使用正则表达式,但有没有其他方法可以做到这一点?
【问题讨论】:
-
我认为我已经相当成功地使用了这个。试试看。 sachinhandiekar.com/2011/12/…
标签: java regex xml code-formatting