You will see the best XML formatter online in this post. And some amazing offline ones on Windows and Linux.
In fact, these are the formatters I always use for my XML codes.
Stay with me as I explain my personal best, which is offline before I give you the online formatters.
Let’s dive right in.
Simple XML Formatter Using Notepad ++
You can easily format your XML code in Notepad ++ by following the simple steps below.
Step1 How To Install XML Tools Plugin On Your Notepad++
Open Notepad ++ and install XML Tools plugin. Follow this: Plugins > Plugin Manager > Show Plugin Manager
On the Show Plugin Manager page, click on any of the available names at the left and type XML Tools.
Now click the XML Tools name and install it using the install button below the pane.
Restart the Notepad ++ application and the installation.
Step 2 How To Use Notepad ++ As XML Formatter
Open your XML code using the Notepad ++. Then click on the Plugins menu at the top of the page.
Select XML Tools. It is among the items in the Plugins menu. You will get a little window that consists of all the available tools to format your XML code.
The one you will use as XML formatter is the Pretty print XML with indent and line breaks.
Click on it and the XML code will format and show line breaks with nice and easy to read indentation.
Also Read Online JSON Formatter
How To Validate XML Code Against A XML Schema XSD
Open your XML code then click on the XML Tools under the Plugins menu.
Select the Validate link in the XML Tools. You will provide the XSD file for the XML Code.
The validation will save all the elements of the current XML file to the XSD so you will be able to validate the XML file after further developments are made to the current one.
Other Functions You Will Find In The XML Tools Format Plugin
You will find all the tools needed to format and modify an XML code.
However, I have found the formatting and Syntax correction tools to be very useful.
Awesome XML Formatter Online
XML Formatter On Linux Shell Script
You will rarely see a programmer write an XLM code without formatting it. But how come there is much code without format and indentation?
There are a few reasons why.
It is either the code is generated by a script and/or the person that wrote the script doesn’t want people to have ultimate access and ease to the code.
So how do you use an XML formatter on Linux?
Let me show you how to get a code from any site online.
For example, I want to get the HTML code of code academy using the Linux Shell script.
Type the below code:
curl – -silent “http://codecademy.com”
That line of code will get all the HTML code on codecademy.com for you. However, there won’t be any indentation or line breaks in the result.
Everything will just be packed together. No one likes to read such code.
So how do you turn it around?
How To Format XML In Linux Using XMLLINT
curl – -silent “http://codecademy.com” |xmllint – -html – – format – |more
The above code will get you the html of the website and format it in a readable way.
Curl is the command that gets the code from the website.
Silent is used because the content from the website can take a little time to download and to prevent some unnecessary loading indications.
Xmillint is the tool that enables the formatting feature we need.
Html is the code we want to get from the website. It is important to note that you can use XML here too. So far the site has XML.
Format makes the code easy for you to read.
More prevents all the code from downloading to the screen all at once. You will use Enter key to load the code as you which.
The main part of this line of command is the xmllint and it has many more functions aside being XML formatter.
To get the whole uses of xmllint, use the following code:
Finally, awesome XML formatter online that that is easy to use. And more importantly, you’ve got yourself some of the best ways to format your XML code offline.
We discussed how to format XML code using Notepad ++. Then the best online sites for the same purpose. And lastly, how to format using XMLLINT on Linux operating system.
I am very sure that you won’t be short of quality XML formatter if you follow the simple tools, sites and ideas I have shared in this post.
The last action is your hand… kindly share this post.