So I have this following XML file poorly line indented.

<?xml version="1.0" encoding="utf-8"?><H2HData date="19.08.2013 17:04:01"><Sport id="1" name="Futbol"><Country id="6" name="İsveç"><Tournament id="20" name="İsveç Allsvenskan Ligi"><Season id="9007" name="2013"><Stage id="19018" name="Lig"><Match id="11755684" name="Djurgarden - Hacken">

So what I want to do is for example, after a tag is closed insert a new line like :

<?xml version="1.0" encoding="utf-8"?>
    <H2HData date="19.08.2013 17:04:01">
        <Sport id="1" name="Futbol">
            <Country id="6" name="İsveç">
                <Tournament id="20" name="İsveç Allsvenskan Ligi">

Is there an easy way to do this?

有帮助吗?

解决方案

You actually want to pretty print your XML. In Notepad++ you can install the XML Tools plugin.

The problem is that in your example this won't work. The plugin will complain since the provided example is not valid XML (tags are not being closed).

其他提示

If you're using Sublime Text, get the Indent XML plugin from Package Control. Once installed, you can use CtrlK, CtrlF, or Selection -> Format -> Auto Indent after selecting the text you want to format. The plugin works in both ST2 and ST3, and can also be used to format JSON.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top