Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6438 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55958 invoked by uid 1010); 14 Dec 2003 06:09:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55909 invoked from network); 14 Dec 2003 06:09:26 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by pb1.pair.com with SMTP; 14 Dec 2003 06:09:26 -0000 Received: from ipaq (pcp01140033pcs.mtmors01.mi.comcast.net[68.62.49.253]) by comcast.net (sccrmhc12) with SMTP id <200312140609260120001s5ue>; Sun, 14 Dec 2003 06:09:26 +0000 To: PHP Internals Content-Type: text/plain Message-ID: <1071382210.6877.147.camel@coogle.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sun, 14 Dec 2003 01:10:10 -0500 Content-Transfer-Encoding: 7bit Subject: Tidy and B3 From: john@coggeshall.org (John Coggeshall) In response to the suggestions of Thies and others, I went back through tidy and made a number of improvements to the API that I think should make most people happy and make tidy ready for B3. Notable changes are: Multiple Document Processing $a = tidy_parse_file("http://www.php.net/"); tidy_clean_repair($a); echo tidy_get_output($a); Dual-Nature Object and object overloading: $a = tidy_parse_file("http://www.php.net/"); $a->clean_repair(); echo $a; echo $a->error_buf; /* or... */ $a = new tidy_doc(); $a->clean_repair(); /* Of course, you can also cross-use the syntax */ $a = new tidy_doc(); tidy_clean_repair($a); echo $a; A bit cleaner parsing ability: /* Get the Body node object */ $body = $a->body(); /* Get the 'BGCOLOR' attribute of the node */ echo $body->attribute['bgcolor']; /* echo everything from .... */ echo $body; /* Check to see if there is any content of the body by looking for a child node. If there is, echo only the content of the body... */ if($body->has_children()) { echo $body->child[0]; /* Another node */ } You can also specify a default tidy configuration setup by setting tidy.default_config to a default configuration file, and automatically have tidy clean/repair the output by setting tidy.clean_output to true. I think with these changes tidy is ready to be packaged in B3, since no one really opposed it before can we get this done ASAP? If you'd like to play with tidy yourself, I have committed my work to HEAD in pecl/tidy John -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- John Coggeshall http://www.coggeshall.org/ The PHP Developer's Handbook http://www.php-handbook.com/ -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-