I have a large XML file in one line.
How can I add a line break for each tag so that it is not in one line in my editor?
I am using notepad ++
Thanks in advance
use <br/> ; or.
XML does not require a specific form of line break, so you can use whatever is convenient (carriage return, linefeed, or a combination) when creating an XML file. XML parsers will do the right thing largely because they're parsing on tags, not records - so whatever line break you're using is just whitespace to XML.
It depends on how you're reading and writing the XML. - then there's nothing to worry about. Your input likely doesn't have any other XML in it so it's just cleaner to not mess with XML at all. If tags are being worked with manually, it's still cleaner to just have a line break, if you ask me.
From the menu , go to
Plugins --> XML Tools --> Pretty Print
If you don't have the XML tools plugin installed, you can download it by clicking on
Plugins --> Show Plugin Manager
And choosing XML Tools
Perhaps that will be useful to someone:
How can I add a line break for each tag so that it is not in one line in my editor?
To do that to several files, automatically, I use XmlLint:
xmllint YOUR_FILE.xml --format
XmlLint is available in the Kubuntu/Ubuntu packages, and also can be downloaded for several operating systems in: ftp://xmlsoft.org/libxml2/
instead of of doing this : Plugins --> XML Tools --> Pretty Print , you can use this usefull shortcut : Ctrl + Alt + shift + B
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With