« Simple C++ gettext-like toolkit | Home | Windows SteadyState – a free DeepFreeze? »
Free and open source XML beautifers to format XML
By admin | December 26, 2009
XML is a great format for storing data, but an improperly-formatted XML file (e.g. whole file on one line, unusual breaking, improper line wrap, etc) can be just as difficult to read as a binary blob. In order to make “blob” XML readable, here are some tools you can use to format XML so it’s readable.
- A makeshift Python beautifier – A simple XML formattor written in Python, this formattor formats XML and actually works. Unfortunately, it formats <element>value</element> into
<element> value </element>
Which can actually decrease readability, especially if you have lots of short elements.
- HTML Tidy – Official HTML/XHTML formattor endorsed by the World Wide Web Consortorium. However the XML it formatted refused to contain indents, even after enabling all indenting and formatting options. It formatted <tag1><tag2><tag3>xyz</tag3></tag2></tag1> into
<tag1> <tag2> <tag3>xyz</tag3> </tag2> </tag1>
This is not much good since indents are generally required in human readable XML.
- PHP XML beautifier – Small PHP based XML beautifier. The only one that actually worked properly and formatted readable XML. Formatted <tag1><tag2><tag3>xyz</tag3></tag2></tag1> into
<tag1> <tag2> <tag3>xyz</tag3> </tag2> </tag1>
Which is the expected result. For more consistency, you might want to change (in BeautyXML.class.php)
var $how_to_ident = " "; // you can user also \t or more/less spaces
to
var $how_to_ident = "\t"; // you can user also \t or more/less spaces
to use tabs instead of spaces to save file space.
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: (X)HTML, HTTP (Internet) | 27 Comments »
February 23rd, 2022 at 21:03
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
April 14th, 2022 at 11:28
… [Trackback]
[…] Read More Info here to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
April 25th, 2022 at 18:40
… [Trackback]
[…] There you can find 76196 more Information on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
April 30th, 2022 at 18:00
… [Trackback]
[…] Here you can find 60524 more Info to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
May 2nd, 2022 at 22:41
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
June 8th, 2022 at 05:11
… [Trackback]
[…] Here you can find 46174 more Info on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
June 22nd, 2022 at 10:09
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
July 2nd, 2022 at 01:43
… [Trackback]
[…] Read More on on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 3rd, 2022 at 03:51
… [Trackback]
[…] Read More to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 8th, 2022 at 19:46
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 9th, 2022 at 06:38
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 12th, 2022 at 18:36
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 18th, 2022 at 18:30
… [Trackback]
[…] Read More Information here on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 21st, 2022 at 11:17
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
August 23rd, 2022 at 16:49
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
September 8th, 2022 at 09:27
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
September 9th, 2022 at 13:40
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
September 19th, 2022 at 19:48
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
October 10th, 2022 at 10:56
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
October 25th, 2022 at 08:32
… [Trackback]
[…] There you will find 96204 more Info to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
October 30th, 2022 at 03:58
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
December 11th, 2022 at 18:23
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
December 13th, 2022 at 05:29
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
December 18th, 2022 at 22:21
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
January 9th, 2023 at 14:10
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
January 12th, 2023 at 09:29
… [Trackback]
[…] Find More Info here to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]
February 1st, 2023 at 08:20
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2009/12/26/free-and-open-source-xml-beautifers-to-format-xml/ […]