ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Alternative version of HTML::Tidy
by Michael Houghton other posts by this author
Jan 30 2005 11:45AM messages near this date
view in the new Beta List Site
Re: Alternative version of HTML::Tidy | RE: Contents of Perl-XML Digest, Vol 12, Issue 18
& XSLT Hi all,

  I've been using HTML Tidy extensively in a custom content management 
system for about three and a half years, with an IPC::Open3 wrapper to 
the tidy binary - a pre-libtidy solution that has served me quite well 
until recently, when I concluded I needed some more speed, and slightly 
more informative output.

  I decided to switch to the HTML::Tidy CPAN module, but didn't find an 
easy way to pass in configuration directives etc.

  Having noted that the XS in HTML::Tidy is somewhat monolithic, I've 
spent a little time writing a slightly more modular XS wrapper from 
scratch. It seems to have been a useful way to learn XS if nothing 
else, but it should be useful as the basis of more work.

  The broad brush of the new API is as follows:

	use HTML::Tidy::Simple;

	$tidy = new HTML::Tidy::Simple(
      input_file =>  $html_file,             # or from string: input => 
$html
      config_file =>  $cfg_file,             # optionally specify a tidy 
config file
      config =>  { 'output-xhtml' => 'yes' } # optionally specify config 
directives
     );

     my $status = $tidy-> status;            # tidy processor status

     my $result = $tidy-> result;            # tidied result

     my $errs = $tidy-> errors;              # produces a hash of error 
counts
                                            # (AccessWarning, Warning, 
Error, ConfigError)

     my $errlog = $tidy-> error_log;         # the HTML Tidy error log


  It's my feeling that the API here is different enough to break 
compatibility with HTML::Tidy - hence the name - but I felt I'd get 
this out there anyway, and perhaps merge back into HTML::Tidy (if Mr 
Lester is in agreement) at some point in the future.

  I'm planning on submitting this new module to CPAN, but before I do 
so, I'd like to ask if anyone could help me test it out. If you'd like 
to, let me know by email.

I should have a version that is ready to be sent to people for testing 
within the next day or so.

  Thanks in advance

	Mike Houghton

_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved