XML removing closing/opening tags



I have a problem with a piece of XML that I want to parse with PHP. Here is the example I have:



<tags>
<content>content</content>
<amplifications>
<tag>content 1</tag>
</amplifications>
<amplifications>
<tag>content 2</tag>
<tag>content 3</tag>
<tag>content 4</tag>
<tag>content 5</tag>
</amplifications>
</tags>


Where I want to remove



</amplifications>
<amplifications>


I've tried using preg_replace, but it seems that I cannot figure it out because those tags are indented differently and there are whitespaces.


No comments:

Post a Comment