How to delete a element by tag name with all elements inside it

后端 未结 2 913
盖世英雄少女心
盖世英雄少女心 2021-01-28 15:49

I want to use the dom removeChild function in php to remove everything between a tag.

my xml looks like


  text         


        
2条回答
  •  借酒劲吻你
    2021-01-28 16:14

    You can use XPath and delete over XPath the node.

    Use DOM and XPath to remove a node from a sitemap file

    PHP SimpleXML - Remove xpath node

    here on Stackoverflow are a lot of posts. Perhaps you should search here at first.

提交回复
热议问题