Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Tidy, space remove after tag.

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
Hi

Anyone run into this before?

Code:
$xml= "<content><span>this is some</span> xml test</content>";

$tidy_options = array(
    'input-xml'        => true,
    'output-xml'       => true,
    'indent'           => true,
    'wrap'             => false,
    'show-body-only'   => true,
    'input-encoding'   => mb_detect_encoding($html),
    'output-encoding'  => 'utf8',
    'alt-text'         => 'HKMEx',
    'show-errors'      => 0,
    'show-warnings'    => 0
);

$tidy = new tidy();
$tidy->parseString($xml, $tidy_options);
$tidy->cleanRepair();

print $tidy;

This outputs:

<content>
<span>this is some</span>xml test</content>

Note the space is gone after "</span>" causing it to visually appear like this: this is somexml test.

How can I prevent tidy from removing that space?

I have little to no control over what is inside of the <content> element and it is dynamic, so it could be any short html sentence with or without html markup.


Cheers
Thomas


site | blog | iphones |
 
Would need to see the $tidy function.

If you can't stand behind your troops, stand in front of them.
Semper Fidelis

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top