a) Du kannst das zum Beispiel mit xsl lösen. Einfaches Beispiel:
PHP-Code:
<?php
$xsl = new XSLTProcessor();
$xsl->importStyleSheet(DOMDocument::loadXML('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="*">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="p">
<xsl:text>

</xsl:text><xsl:apply-templates /><xsl:text>


</xsl:text>
</xsl:template>
<xsl:template match="div">
<xsl:text>

</xsl:text><xsl:apply-templates /><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="br">
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>'));
$html = DOMDocument::loadHTML('<html><body><p>test1</p>test2<br />test3<div>test4</div><h1>test5</h1></body></html>');
echo $xsl->transformToXML($html);
Vielleicht findest Du dafür auch ein komplexeres, vollständigeres Stylesheet.
b) Ja, irgendein Texteditor.