W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2011

Minify an xml in one line

From: Jérôme DESPATIS <jerome@despatis.com>
Date: Mon, 22 Aug 2011 21:10:03 +0200
Message-ID: <4E52A98B.9030902@despatis.com>
To: html-tidy@w3.org

I have an xml file
I'd like to create the smallest file as I can.
So as a result I'd like that my xml holds on a single line (or 2 lines, 
the <?xml...> being the first line)

Any idea how to do this with tidy ? I haven't found the parameter to 
perform that in tidy.
And another thing, I'd like to avoid post process that removes the \n, 
as my xml may contain CDATA with \n in it, that I have to leave untouched

My config for tidy is:
$config = array('input-xml'  => true,
                         'output-xml' => true,
                         'indent'     => true,
                         'wrap'       => 0);

A minimalistic xml could be:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

What I would like to have is the 2 lines (or even 1 line):
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

Any idea is welcome


Jérôme Despatis
Received on Wednesday, 24 August 2011 12:37:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:58 UTC