So another CDATA returning content question. I\'ve seen many answers, but even though I tried them all, I still get only content.
In more details:
I have an xml
I think your example returns 'content' because you are concatenating an element that does not exist
$element->NewsComponent->ContentItem->DataContent->body->body
with the string 'content' - probably PHP complains that there's no constant with the name content and therefore assumes you meant 'content'.
Thus my guess is you need to find another way to select an element with a dot in the name.
(This problem does not appear to be related to CDATA.)
For element names which cannot be PHP identifiers (like body.content
), you must use an alternative PHP notation:
$element->NewsComponent->ContentItem->DataContent->body->{'body.content'};