No linebreak after tags in tidy
Asked Answered
S

2

5

HI, I have the following input:

<p>Hi <span>you</span></p>

I'd like to treat this as XML.

I run Tidy on the cmd-line with the following options:

input-xml: yes 
output-xml: yes 
indent: no

My output is this:

<p>Hi 
<span>you</span></p>

However I'd like tidy to not pretty-print the xml. I'd like it to respect all white space, and not add that line break. I can't seem to find a way to output XML without pretty-printing. Anyone know how to do this?

Sinh answered 29/10, 2010 at 0:46 Comment(0)
B
1

I had the same problem. I found a possible solution and posted it at PHP Tidy removes whitespace and inserts newlines

The summary is: put <pre>-tags around the xml you want to repair, use output-html = true, then remove the <pre>-tags and newlines.

Barfuss answered 1/3, 2013 at 21:36 Comment(0)
K
0

For anyone using JTidy (the Java port of Tidy), the old version on SourceForge had this bug. JTidy has been moved to a new GitHub repo, and this particular bug is fixed in the latest version. Switching to this newer version fixed the problem for me.

Kwa answered 28/3, 2023 at 14:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.