Skip to content

Instantly share code, notes, and snippets.

@markwatson
Created August 1, 2009 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwatson/159782 to your computer and use it in GitHub Desktop.
Save markwatson/159782 to your computer and use it in GitHub Desktop.
The first is to use the object oriented way:
$config = array(
           'indent'         => true,
           'output-xml'   => true,
           'wrap'           => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($xml, $config, 'utf8');
$tidy->cleanRepair();
$result = (string) $tidy;
But I get the error:
Fatal Error: Class ‘tidy’ not found
The second is to just call the function like so:
$result = tidy_parse_string($xml, $config, 'utf8');
However then I get the error:
tidy_parse_string() expects exactly 1 parameter 3 given
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment