[xml] Free XML Formatting tool

Is there a free XML formatting (indent) tool available where I can past an XML string and have it formatted so I can read the XML document correctly?

Thanks

Edit ~ I am using XML Notepad on Windows XP.

This question is related to xml xml-formatting

The answer is


You can open the XML file in any Visual Studio Express product and the press Ctrl+A, Ctrl+K, Ctrl+F to get it nicely formatted.

Hey, it's free and it's a tool, so it fits the question. :-)


Firstobject's free XML editor for Windows is called foxe is a great tool.

Open or paste your XML into it and press F8 to indent (you may need to set the number of indent spaces as it may default to 0).

It looks simple, however it contains a custom written XML parser written in C++ that allows it to work efficiently with very large XML files easily (unlike some expensive "espionage" related tools I've used).

From the product page:

The full Visual C++ source code for this firstobject XML editor (including the CDataEdit gigabyte edit control MFC component) is available as part of the Advanced CMarkup Developer License. It allows developers to implement custom XML handling functions such as validation, transformation, beautify, and reporting for their own purposes.


If you are a programmer, many XML parsing programming libraries will let you parse XML, then output it - and generating pretty printed, indented output is an output option.


Try http://prettydiff.com/ The algorithm is similar to HTML Tidy, but is more complete. The program is written entirely in JavaScript, so you don't have to install anything.


If you use Notepad++, I would suggest installing the XML Tools plugin. You can beautify any XML content (indentation and line breaks) or linarize it. Also you can (auto-)validate your file and apply XSL transformation to it.

Download the latest zip and copy the extracted DLL to the plugins directory of your Notepad++ installation. Also, download the External libs and copy them to your %SystemRoot%\system32\ directory.


You can open the XML file in any Visual Studio Express product and the press Ctrl+A, Ctrl+K, Ctrl+F to get it nicely formatted.

Hey, it's free and it's a tool, so it fits the question. :-)


Try http://prettydiff.com/ The algorithm is similar to HTML Tidy, but is more complete. The program is written entirely in JavaScript, so you don't have to install anything.


Firstobject's free XML editor for Windows is called foxe is a great tool.

Open or paste your XML into it and press F8 to indent (you may need to set the number of indent spaces as it may default to 0).

It looks simple, however it contains a custom written XML parser written in C++ that allows it to work efficiently with very large XML files easily (unlike some expensive "espionage" related tools I've used).

From the product page:

The full Visual C++ source code for this firstobject XML editor (including the CDataEdit gigabyte edit control MFC component) is available as part of the Advanced CMarkup Developer License. It allows developers to implement custom XML handling functions such as validation, transformation, beautify, and reporting for their own purposes.


Not directly an answer, but good to know nevertheless: After indenting, please make sure that the parser(s) and application(s) which will subsequently process the formatted XML will not yield different results. White space is often significant in XML and most conforming parsers bubble it up to the application.


If you use Notepad++, I would suggest installing the XML Tools plugin. You can beautify any XML content (indentation and line breaks) or linarize it. Also you can (auto-)validate your file and apply XSL transformation to it.

Download the latest zip and copy the extracted DLL to the plugins directory of your Notepad++ installation. Also, download the External libs and copy them to your %SystemRoot%\system32\ directory.


You can open the XML file in any Visual Studio Express product and the press Ctrl+A, Ctrl+K, Ctrl+F to get it nicely formatted.

Hey, it's free and it's a tool, so it fits the question. :-)


Not directly an answer, but good to know nevertheless: After indenting, please make sure that the parser(s) and application(s) which will subsequently process the formatted XML will not yield different results. White space is often significant in XML and most conforming parsers bubble it up to the application.


Advanced Conventional Formatting [Update]

XMLSpectrum is an open source syntax-highlighter. Supporting XML - but with special features for XSLT 2.0, XSD 1.1 and XPath 2.0. I'm mentioning this here because it also has special formatting capabilities for XML: it vertically aligns attributes and their contents as well as elements - to enhance XML readability.

The output HTML is suitable for reviewing in a browser or if the XML needs further editing it can be copied and pasted into an XML editor of your choice

Because xmlspectrum.xsl uses its own XML text parser, all content such as entity references and CDATA sections are preserved - as in an editor.

enter image description here

Note on usage: this is just an XSLT 2.0 stylesheet so you would need to enclose the required command-line (samples provided) in a small script so you could automatically transform the XML source.

Virtual Formatting

XMLQuire is a free XML editor that has special formatting capabilities - it formats XML properly, including multi-line attributes, attribute-values, word-wrap indentation and even XML comments.

All XML indentation is done without inserting tabs or spaces, ensuring the integrity of the XML is maintained. For versions of Windows later than XP, no installation is needed, its just a 3MB .exe file.

If you need to print out the formatted XML there are special options within the print-preview, such as line-numbering that follows the indentation. If you need to copy the formatted XML to a word processor as rich text, that's available too.

[Disclosure: I maintain both XMLQuire and XMLSpectrum as 'home projects']


Use the following:

xmllint --format


Not directly an answer, but good to know nevertheless: After indenting, please make sure that the parser(s) and application(s) which will subsequently process the formatted XML will not yield different results. White space is often significant in XML and most conforming parsers bubble it up to the application.


You could also try http://xmltoolbox.appspot.com/ it is an online xml formatter. You just paste your xml into a large text area field and press "format xml" then it pretty prints the xml in the text area so its easy to read or copy.

There is also a nice little filter feature that allows you to see all of a certain element.

Hope you will enjoy the tool


You can open the XML file in any Visual Studio Express product and the press Ctrl+A, Ctrl+K, Ctrl+F to get it nicely formatted.

Hey, it's free and it's a tool, so it fits the question. :-)


Use the following:

xmllint --format


Notepad++ dit it well only if you're in ANSI. If you do it in something like "ANSI AS UTF8", tidy dirty the doc :/.


Use the following:

xmllint --format


Another method to reindent XML in Notepad++:

From menu select Plugins -> XML Tools -> Pretty print (XML only – with line breaks)
or press Ctrl+Alt+Shift+B.


Firstobject's free XML editor for Windows is called foxe is a great tool.

Open or paste your XML into it and press F8 to indent (you may need to set the number of indent spaces as it may default to 0).

It looks simple, however it contains a custom written XML parser written in C++ that allows it to work efficiently with very large XML files easily (unlike some expensive "espionage" related tools I've used).

From the product page:

The full Visual C++ source code for this firstobject XML editor (including the CDataEdit gigabyte edit control MFC component) is available as part of the Advanced CMarkup Developer License. It allows developers to implement custom XML handling functions such as validation, transformation, beautify, and reporting for their own purposes.


Advanced Conventional Formatting [Update]

XMLSpectrum is an open source syntax-highlighter. Supporting XML - but with special features for XSLT 2.0, XSD 1.1 and XPath 2.0. I'm mentioning this here because it also has special formatting capabilities for XML: it vertically aligns attributes and their contents as well as elements - to enhance XML readability.

The output HTML is suitable for reviewing in a browser or if the XML needs further editing it can be copied and pasted into an XML editor of your choice

Because xmlspectrum.xsl uses its own XML text parser, all content such as entity references and CDATA sections are preserved - as in an editor.

enter image description here

Note on usage: this is just an XSLT 2.0 stylesheet so you would need to enclose the required command-line (samples provided) in a small script so you could automatically transform the XML source.

Virtual Formatting

XMLQuire is a free XML editor that has special formatting capabilities - it formats XML properly, including multi-line attributes, attribute-values, word-wrap indentation and even XML comments.

All XML indentation is done without inserting tabs or spaces, ensuring the integrity of the XML is maintained. For versions of Windows later than XP, no installation is needed, its just a 3MB .exe file.

If you need to print out the formatted XML there are special options within the print-preview, such as line-numbering that follows the indentation. If you need to copy the formatted XML to a word processor as rich text, that's available too.

[Disclosure: I maintain both XMLQuire and XMLSpectrum as 'home projects']


If you are a programmer, many XML parsing programming libraries will let you parse XML, then output it - and generating pretty printed, indented output is an output option.


If you are a programmer, many XML parsing programming libraries will let you parse XML, then output it - and generating pretty printed, indented output is an output option.


If you use Notepad++, I would suggest installing the XML Tools plugin. You can beautify any XML content (indentation and line breaks) or linarize it. Also you can (auto-)validate your file and apply XSL transformation to it.

Download the latest zip and copy the extracted DLL to the plugins directory of your Notepad++ installation. Also, download the External libs and copy them to your %SystemRoot%\system32\ directory.


Notepad++ dit it well only if you're in ANSI. If you do it in something like "ANSI AS UTF8", tidy dirty the doc :/.


Another method to reindent XML in Notepad++:

From menu select Plugins -> XML Tools -> Pretty print (XML only – with line breaks)
or press Ctrl+Alt+Shift+B.


You could also try http://xmltoolbox.appspot.com/ it is an online xml formatter. You just paste your xml into a large text area field and press "format xml" then it pretty prints the xml in the text area so its easy to read or copy.

There is also a nice little filter feature that allows you to see all of a certain element.

Hope you will enjoy the tool


If you are a programmer, many XML parsing programming libraries will let you parse XML, then output it - and generating pretty printed, indented output is an output option.


Use the following:

xmllint --format


Firstobject's free XML editor for Windows is called foxe is a great tool.

Open or paste your XML into it and press F8 to indent (you may need to set the number of indent spaces as it may default to 0).

It looks simple, however it contains a custom written XML parser written in C++ that allows it to work efficiently with very large XML files easily (unlike some expensive "espionage" related tools I've used).

From the product page:

The full Visual C++ source code for this firstobject XML editor (including the CDataEdit gigabyte edit control MFC component) is available as part of the Advanced CMarkup Developer License. It allows developers to implement custom XML handling functions such as validation, transformation, beautify, and reporting for their own purposes.


Not directly an answer, but good to know nevertheless: After indenting, please make sure that the parser(s) and application(s) which will subsequently process the formatted XML will not yield different results. White space is often significant in XML and most conforming parsers bubble it up to the application.


If you use Notepad++, I would suggest installing the XML Tools plugin. You can beautify any XML content (indentation and line breaks) or linarize it. Also you can (auto-)validate your file and apply XSL transformation to it.

Download the latest zip and copy the extracted DLL to the plugins directory of your Notepad++ installation. Also, download the External libs and copy them to your %SystemRoot%\system32\ directory.