Welcome! » Log In » Create A New Profile

What is the way to remove all whitespace and   from the HTML

Posted by csplrj 
What is the way to remove all whitespace and   from the HTML
August 30, 2009 07:17AM

What is the way to remove all whitespace and   from the HTML?

I tried this but then also values in the attribute does not remove spaces $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); $config->set('HTML.TidyLevel', 'heavy'); $config->set('Attr.EnableID', true); $config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true); $config->set('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions',array());

$obj = new HTMLPurifier($config);

But this does not converts

<span style="color:#ffffff;font-family:arial;font-size:small;"><b>  Type</b></span>

to

<span style="color:#ffffff;font-family:arial;font-size:small;"><b>Type</b></span>

It does not removes extra trailing spaces

Thanks in advance

CSJakharia

Re: What is the way to remove all whitespace and &nbsp; from the HTML
August 30, 2009 01:59PM

That's because RemoveEmpty removes elements with only whitespace in them, and does not otherwise remove whitespace.

Sorry, you do not have permission to post/reply in this forum.