xmlsublimetext2notepad++xml-formatting

How to insert new line after closed tags in Sublime or notepad++?


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?


Solution

  • 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).