Ho il seguente codice HTML:Rimuovere tag vuoti con interruzioni di riga da HTML
<body>Summary: <br>
<table class="stats data tablesorter marg-bottom">
<thead><tr><th>Team</th><th>Wins</th><th>Losses</th><th>Ties</th><th>Win %</th></tr></thead>
<tbody>
<tr>
<td>Team 1</td>
<td>95</td>
<td>74</td>
<td>0</td>
<td>56.21</td>
</tr>
<tr>
<td>Team 2</td>
<td>74</td>
<td>95</td>
<td>0</td>
<td>43.79</td>
</tr>
</tbody>
</table>
<div>
</div>
</body>
E voglio questo come risultato:
<body>Summary: <br>
<table class="stats data tablesorter marg-bottom">
<thead><tr><th>Team</th><th>Wins</th><th>Losses</th><th>Ties</th><th>Win %</th></tr></thead>
<tbody>
<tr>
<td>Team 1</td>
<td>95</td>
<td>74</td>
<td>0</td>
<td>56.21</td>
</tr>
<tr>
<td>Team 2</td>
<td>74</td>
<td>95</td>
<td>0</td>
<td>43.79</td>
</tr>
</tbody>
</table>
</body>
più semplice sarebbe quella di codificare correttamente, purtroppo, questo viene da una versione molto vecchia di CKEditor e non posso aggiornarlo (a causa di altre implicazioni).
Che cosa è la funzione o ciclo ricorsivo preg_replace
o ricorsiva posso eseguire per rimuovere i tag vuoti <div>
e le righe vuote non necessarie?
cosa quasi simillar è stato fatto, è può vedere qui http://stackoverflow.com/questions/30865464/how-to-remove-empty-html-tags-wich-contain-whitespaces-and-or-thethe-html- cod –