XML Minifier Online Tool

About XML Minifier Online Tool:

This online xml minifier tool helps you to minify raw XML string to save space to transmit faster cross Internet.

comic xml minifier

Basic idea of XML:

XML is a data format specification, a format specification that contains data and data descriptions.

For example: We want to send a piece of data to the other party, the data content is "too young too simple sometimes naive", if you want to split this paragraph into three data according to the attribute, that is, age: too young; experience: too simple; result: sometimes naive.

For human the expression is "too young,too simple,sometimes naive", Information is split by comma, the first part is the age, the second part is the experience, and the third part is the result. This method can be used to hold data and can be parsed, but it is not intuitive, and the versatility is not good. If there is a string that exceeds the limit of the number of words, it can not be parsed, and the data itself may contain comma!!!

We all know that programs are not like people, we can understand the literal meaning, and automatically split the data, so we need to help the program to do the split, so there are a variety of data formats and split methods.

To address this problem, XML is invented, and the above data is expressed in XML can be like this

<person age="too young" experience="too simple" result="sometimes naive" />

or like this:

    <age value="too young" />
    <experience value="too simple" />
    <result value="sometimes naive" />

even like this:

<person age="too young" experience="too simple">
    <result value="sometimes naive" />

ALl above XML intuitive describe the data, and they are common format specification for the program to parse.

Does XML Minifier Online Tool log my data?

Absolutely NOT, this XML Minifier doing all the formatting work on the client side, all logic are implemented by Javascript. There are 2 major advantages: 1.Your data never transmitted in the Open Internet, so you know it's secure; 2.It's much faster than doing all the work in the server side, because there is no Internet Delay.

More information about XML (Extensible Markup Language):

RFC 3470 (XML): https://tools.ietf.org/html/rfc3470

Python Implementation of XML (BeautifulSoup): https://www.crummy.com/software/BeautifulSoup/

Java Implementation of XML (dom4j): https://dom4j.github.io/

XML Minifier with Python (with package htmlmin):

from htmlmin.minify import html_minify

def xml_minify(xml_str):
    xml_str = html_minify(xml_str, parser="lxml")
    return xml_str

XML Minifier with Java (with package dom4j):

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public String minify(String xmlStr){
    Document document=DocumentHelper.parseText(xmlStr);
    OutputFormat format=OutputFormat.createPrettyPrint();
    StringWriter stringWriter=new StringWriter();
    XMLWriter writer=new XMLWriter(stringWriter,format);
    String resultStr=stringWriter.toString();
    return resultStr;