The following problem seems to be hard to solve:

A PHP-Script reads in an HTML-File and removes linebreaks, tabs and not needed spaces. After that the script should reconstruct the table-structure this way (example):

<table ... >
  <tr ... >
    <td ... >
      <table ...>
        <tr ... >
          <td ... >
            ...
          </td>
          <td ... >
            ...
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

The next thing is that lines longer than for instance 80 chars ($maxlength) should be split up into several lines.

Is there any good way to solve this? Regular expressions seem to be of limited use because the recursion of tables can be infinitely deep and the lines between <td and </td> must not not be longer than $maxlength and should have the appropriate number of spaces before it. Stepping through the string (the whole file is a string) with simple String-functions is very complicated either.

I hope you can give me some hints how to find a (simple) solution for this problem.

Jens


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to