質問

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