How to get the content of two xml tags even when they have another xml tags inside them (PHP-XML)
Posted
by
Harry
on Stack Overflow
See other posts from Stack Overflow
or by Harry
Published on 2013-06-29T16:19:18Z
Indexed on
2013/06/29
16:21 UTC
Read the original article
Hit count: 140
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
© Stack Overflow or respective owner