开发者

Parsing XML file. How do I strip specific text from variable?

I am using SimpleHtmlDom to successfully parse an XML file, but I am getting some useless redundant data for one item and I would like to delete it before it's added to the database.

The specific part I would like to strip is shown below. I would like to completely remove everything from <!-- START CLTAGS --> to <!-- END CLTAGS -->. The information between the Start and End tags changes slightly from item to item, so just need to strip from Start to End.

Some useful information here...blah, blah, blah
<!-- START CLTAGS -->
<br><br><开发者_JS百科;ul class="blurbs">
<li> <!-- CLTAG GeographicArea=nashivlle -->Location: nashivlle
<li>it's NOT ok to contact this poster with services or other commercial interests</ul>
<!-- END CLTAGS -->

I guess I am looking for a php function to remove all that. Thanks.


I would recommend using Regular Expressions to remove all the unnecessary data, by using the preg_replace function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜