问题
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?
回答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.
来源:https://stackoverflow.com/questions/4048234/no-linebreak-after-tags-in-tidy