Re: Minify an xml into one line

Jérôme DESPATIS <[email protected]> Sat, 27 Aug 2011 14:23:31 +0200
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============7800076923376851520==
Content-Type: multipart/alternative;
	boundary="------------060005030204090603060509"

This is a multi-part message in MIME format.
--------------060005030204090603060509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Ok

But before to test under php, I'm testing using tidy on the shell

I can do tidy -xml -wrap 0 --indent false --newline CRLF my.xml

With newline I can put CR or LF or CRLF, but nothing else

With CRLF, tidy uses \r\n as newline, yes, but it also uses this newline 
for newlines in the CDATA

As a result, I can't force tidy to use a specific newline like CRLF (I'm 
on Linux), and delete the \r\n afterwards, It would also suppress the 
newlines in my CDATA, which I don't want

I think I'm gonna keep those \n in my tidified xml output :)

Maybe one day, tidy will have an option for not putting each tag on a 
new line ? (it has already an option to put each attribute on a new 
line, or not)

Thanks


Le 27/08/2011 13:55, Ger Hobbelt a écrit :
> On Sat, Aug 27, 2011 at 12:14 PM, Jérôme DESPATIS <[email protected] 
> <mailto:[email protected]>> wrote:
>
>        You're talking about the TidyNewline, but can I change this
>     value in a config file somewhere ?
>     Because I only see it in
>     http://tidy.sourceforge.net/docs/api/tidyenum_8h-source.html, and
>     I would need to recompile tidy in order to change this value I'm
>     afraid, no ?
>
>
> Phew... ehm... that's probably dependent on what the PHP module for 
> tidy does exactly, but _theoretically_ you should be able to feed it a 
> "newline" option with a value of 1,2 or 3 depending on the enum value 
> you want to give it (IIRC the CR, CRLF, LF enum starts with CR=1; 
> anyway, see what a
>    "newline" => 1,
> or other "newline" number value gives you for output.
>
>
> -- 
> Met vriendelijke groeten / Best regards,
>
> Ger Hobbelt
>
> --------------------------------------------------
> web: http://www.hobbelt.com/
> http://www.hebbut.net/
> mail: [email protected] <mailto:[email protected]>
> mobile: +31-6-11 120 978
> --------------------------------------------------
>


-- 
Jérôme Despatis
[email protected]


--------------060005030204090603060509
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Ok<br>
    <br>
    But before to test under php, I'm testing using tidy on the shell<br>
    <br>
    I can do tidy -xml -wrap 0 --indent false --newline CRLF my.xml<br>
    <br>
    With newline I can put CR or LF or CRLF, but nothing else<br>
    <br>
    With CRLF, tidy uses \r\n as newline, yes, but it also uses this
    newline for newlines in the CDATA<br>
    <br>
    As a result, I can't force tidy to use a specific newline like CRLF
    (I'm on Linux), and delete the \r\n afterwards, It would also
    suppress the newlines in my CDATA, which I don't want<br>
    <br>
    I think I'm gonna keep those \n in my tidified xml output :)<br>
    <br>
    Maybe one day, tidy will have an option for not putting each tag on
    a new line ? (it has already an option to put each attribute on a
    new line, or not)<br>
    <br>
    Thanks<br>
    <br>
    <br>
    Le 27/08/2011 13:55, Ger Hobbelt a &eacute;crit&nbsp;:
    <blockquote
cite="mid:CAFP60frUp95VCLi98TEPKkGNMVvnR5jRg==PbrM9A+9_ep9Xog@mail.gmail.com"
      type="cite">
      <div>On Sat, Aug 27, 2011 at 12:14 PM, J&eacute;r&ocirc;me DESPATIS <span
          dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:[email protected]">[email protected]</a>&gt;</span>
        wrote:<br>
      </div>
      <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex;
        border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
        <div bgcolor="#ffffff" text="#000000">&nbsp; &nbsp;You're talking about
          the TidyNewline, but can I change this value in a config file
          somewhere ?<br>
          Because I only see it in <a moz-do-not-send="true"
            href="http://tidy.sourceforge.net/docs/api/tidyenum_8h-source.html"
            target="_blank">http://tidy.sourceforge.net/docs/api/tidyenum_8h-source.html</a>,
          and I would need to recompile tidy in order to change this
          value I'm afraid, no ?<br>
        </div>
      </blockquote>
      <div><br>
      </div>
      <div>Phew... ehm... that's probably dependent on what the PHP
        module for tidy does exactly, but _theoretically_ you should be
        able to feed it a "newline" option with a value of 1,2 or 3
        depending on the enum value you want to give it (IIRC the CR,
        CRLF, LF enum starts with CR=1; anyway, see what a</div>
      <div>&nbsp; &nbsp;"newline" =&gt; 1,</div>
      <div>or other "newline" number value gives you for output.</div>
      <div><br>
      </div>
      <br>
      -- <br>
      Met vriendelijke groeten / Best regards,<br>
      <br>
      Ger Hobbelt<br>
      <br>
      --------------------------------------------------<br>
      web:&nbsp; &nbsp; <a moz-do-not-send="true" href="http://www.hobbelt.com/">http://www.hobbelt.com/</a><br>
      &nbsp; &nbsp; &nbsp; &nbsp; <a moz-do-not-send="true" href="http://www.hebbut.net/">http://www.hebbut.net/</a><br>
      mail:&nbsp;&nbsp; <a moz-do-not-send="true" href="mailto:[email protected]">[email protected]</a><br>
      mobile: +31-6-11 120 978<br>
      --------------------------------------------------<br>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
J&eacute;r&ocirc;me Despatis
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
</pre>
  </body>
</html>

--------------060005030204090603060509--


--===============7800076923376851520==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
--===============7800076923376851520==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tidy-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tidy-develop

--===============7800076923376851520==--