SimpleXML keeps returning content on CDATA element

╄→гoц情女王★ 提交于 2019-12-02 09:17:29

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'};

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.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!