How to get the content of two xml tags even when they have another xml tags inside them (PHP-XML)
- by Harry
In simple terms, let's suppose you have the following xml structure:
<TEXT>Well, I need some help as you <CUSTOMTAG>can</CUSTOMTAG> see.</TEXT>
When extracting the text of this node in PHP with strip_tags(), I am not getting the content of tags.
First step:
What I want to do, is to extract and thus have the following string:
"Well, I need some help as you can see."
Second step:
I would also like to convert the <CUSTOMTAG> and </CUSTOMTAG> to something else, like <e> and </e> for example, and finally have the following string:
"Well, I need some help as you <e>can</e> see."
I would appreciate only tested and working code.
Thanks in advance!
Kind Regards