# Tidy & PHP5

- Thread: https://externals.io/message/5872
- Original archive: https://news-web.php.net/php.internals/5872
- Started by Ilia Alshanetsky on 2003-12-01T13:45:23+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #5873 — Edin Kadribasic — 2003-12-01T13:38:56+00:00

URL: https://externals.io/message/5872#5873 · In reply to: #5872

On Monday, Dec 1, 2003, at 14:45 Europe/Copenhagen, Ilia Alshanetsky 
wrote:

> I would like to propose that tidy extension be bundled with PHP 5.
>
> First of all it'll provide an easy means to validate and/or fix HTML 
> input for
> webforms, which can also help existing functions such as `strip_tags()`. 
> The
> extension can also be used to reduce HTML output by removing 
> formatting,
> which can be quite significant for large pages (even if compression is 
> used).
> Tidy can also be used to provide a rapid means for conversion between 
> HTML
> and XHTML and if needed can even handle XML. To those who need to 
> parse HTML
> it also provides a fairly handy OO API (similar to that of simplexml), 
> which
> would enable people to write fast HTML parsers in PHP.

Sounds like a useful thing for many typical PHP applications, so +1 
from here.

Edin

---

## #5872 — Ilia Alshanetsky — 2003-12-01T13:45:23+00:00

URL: https://externals.io/message/5872#5872

I would like to propose that tidy extension be bundled with PHP 5. 

First of all it'll provide an easy means to validate and/or fix HTML input for 
webforms, which can also help existing functions such as `strip_tags()`. The 
extension can also be used to reduce HTML output by removing formatting, 
which can be quite significant for large pages (even if compression is used). 
Tidy can also be used to provide a rapid means for conversion between HTML 
and XHTML and if needed can even handle XML. To those who need to parse HTML 
it also provides a fairly handy OO API (similar to that of simplexml), which 
would enable people to write fast HTML parsers in PHP.

Ilia

---

## #5878 — Wez Furlong — 2003-12-01T14:29:06+00:00

URL: https://externals.io/message/5872#5878 · In reply to: #5872

+1 from me; very useful for screen scraping as well as validation and
fixing.

--Wez.

----- Original Message ----- 
From: "Ilia Alshanetsky" <ilia@prohost.org>
To: "PHP Internals" <internals@lists.php.net>
Sent: Monday, December 01, 2003 1:45 PM
Subject: [PHP-DEV] Tidy & PHP5


> I would like to propose that tidy extension be bundled with PHP 5.
>
> First of all it'll provide an easy means to validate and/or fix HTML input
for
> webforms, which can also help existing functions such as `strip_tags()`. The
> extension can also be used to reduce HTML output by removing formatting,
> which can be quite significant for large pages (even if compression is
used).
> Tidy can also be used to provide a rapid means for conversion between HTML
> and XHTML and if needed can even handle XML. To those who need to parse
HTML
> it also provides a fairly handy OO API (similar to that of simplexml),
which
> would enable people to write fast HTML parsers in PHP.
>
> Ilia

---

## #5882 — Moriyoshi Koizumi — 2003-12-01T15:23:40+00:00

URL: https://externals.io/message/5872#5882 · In reply to: #5872

+1 if this is counted :)

Moriyoshi



> I would like to propose that tidy extension be bundled with PHP 5.
>
> First of all it'll provide an easy means to validate and/or fix HTML 
> input for
> webforms, which can also help existing functions such as `strip_tags()`. 
> The
> extension can also be used to reduce HTML output by removing 
> formatting,
> which can be quite significant for large pages (even if compression is 
> used).
> Tidy can also be used to provide a rapid means for conversion between 
> HTML
> and XHTML and if needed can even handle XML. To those who need to 
> parse HTML
> it also provides a fairly handy OO API (similar to that of simplexml), 
> which
> would enable people to write fast HTML parsers in PHP.
>
> Ilia

---

## #5883 — John Coggeshall — 2003-12-01T15:31:36+00:00

URL: https://externals.io/message/5872#5883 · In reply to: #5882

> I would like to propose that tidy extension be bundled with PHP 5.

Uhh... +1 from me, too. :)


John

---

## #5884 — Ivan Rodriguez — 2003-12-01T15:37:22+00:00

URL: https://externals.io/message/5872#5884 · In reply to: #5883

+1 there are ... a lot :-)
----- Original Message ----- 
From: "John Coggeshall" <john@coggeshall.org>
To: "PHP Internals" <internals@lists.php.net>
Sent: Monday, December 01, 2003 4:31 PM
Subject: Re: [PHP-DEV] Tidy & PHP5


> > […]
> 
> Uhh... +1 from me, too. :)
> 
> 
> John

---

## #5916 — Georg Richter — 2003-12-01T17:39:57+00:00

URL: https://externals.io/message/5872#5916 · In reply to: #5872

> I would like to propose that tidy extension be bundled with PHP 5.

+1

Georg

---

## #5919 — Thies C.Arntzen — 2003-12-01T17:46:47+00:00

URL: https://externals.io/message/5872#5919 · In reply to: #5916

before bundling i'd like to see the api refined...

right now it's not possible to work with more than one html-doc at a 
time. (tidy_parse_file() does not return a resource to the internal 
tidy doc, so you can only have one doc at a time)

also we should ask ourself if (i haven't used tidy so i might be wrong) 
we want tidy to expose a similar API as SimpleXML does (which we all 
seem to like - be it too magic or not)

re,
tc


Am 01.12.2003 um 18:39 schrieb Georg Richter:

>
> > […]
>
> +1
>
> Georg

---

## #5927 — John Coggeshall — 2003-12-01T18:35:04+00:00

URL: https://externals.io/message/5872#5927 · In reply to: #5919

In the primary use of tidy (which is to validate HTML), there is very
little need for a returned resource other than to clutter the namespace.
Unlike most extensions, where it would be useful imo the resource is
unnecessary. Since we can reuse the container for the tidy
documentation, it's much faster to just perform serial operations for
the general case then it is to reallocate a brand new container every
time for no reason. 

As far as the API itself goes for the OO side of things, I think the API
that is exposed is just fine. Just as is the case with any
screen-scraping tool, the problem is not in the tool but in the document
you are scraping (trying to find that table you want buried in the
document). 

John


> before bundling i'd like to see the api refined...
> 
> right now it's not possible to work with more than one html-doc at a 
> time. (tidy_parse_file() does not return a resource to the internal 
> tidy doc, so you can only have one doc at a time)
> 
> also we should ask ourself if (i haven't used tidy so i might be wrong) 
> we want tidy to expose a similar API as SimpleXML does (which we all 
> seem to like - be it too magic or not)
> 
> re,
> tc
> 
> 
> Am 01.12.2003 um 18:39 schrieb Georg Richter:
> 
> > […]

---

## #5946 — Georg Richter — 2003-12-01T21:11:10+00:00

URL: https://externals.io/message/5872#5946 · In reply to: #5919

> before bundling i'd like to see the api refined...
>
> right now it's not possible to work with more than one html-doc at a
> time. (tidy_parse_file() does not return a resource to the internal
> tidy doc, so you can only have one doc at a time)

Yes, Thies is right here! But

s/resource/object :)

I don't know the tidy api very well, but wouldn't be the normal way to have an 
object for a Document (which was created by tidyCreate) instead to use a 
global value for? So you can work with multiple documents, and you also can 
add additional (userland) functionality. This would be the "normal" behaviour 
for new php5 extensions (simplexml, sqlite, mysqli, mono, ...).

Just my 0,024$

Georg

---

## #5953 — Marcus Boerger — 2003-12-01T21:58:01+00:00

URL: https://externals.io/message/5872#5953 · In reply to: #5946

Hello Georg,

Monday, December 1, 2003, 10:11:10 PM, you wrote:


> > […]

> Yes, Thies is right here! But

> s/resource/object :)

> I don't know the tidy api very well, but wouldn't be the normal way to have an
> object for a Document (which was created by tidyCreate) instead to use a 
> global value for? So you can work with multiple documents, and you also can
> add additional (userland) functionality. This would be the "normal" behaviour
> for new php5 extensions (simplexml, sqlite, mysqli, mono, ...).

I had the idea of a tidy wrapper long ago too. So i am +1
But i also would like to see it with an object (php 5) api and i'd like to
see an output handler, too.



-- 
Best regards,
 Marcus                            mailto:helly@php.net

---

## #5959 — Derick Rethans — 2003-12-01T22:27:54+00:00

URL: https://externals.io/message/5872#5959 · In reply to: #5872

> I would like to propose that tidy extension be bundled with PHP 5.

I'm -1 on this until the API gets cleaned up so that it either makes 1)
use of resources or 2) objects instead of polluting the global scope
with document and related settings.

Derick
