开发者

php DomDocument xpath: how can i print the all html content of an element resulted from an xpath query?

开发者 https://www.devze.com 2023-01-07 04:05 出处:网络
I\'m using DomDocument to query for html elements. when i use $obj->textContent or $obj->nodeValue it returns only the texts that include in the element, it does not return the html representati

I'm using DomDocument to query for html elements. when i use $obj->textContent or $obj->nodeValue it returns only the texts that include in the element, it does not return the html representation of the object.

which means.. if the object contains

<div>test</div>

the return value for both tries will be test.

how do i fetch the html elements as well?

I know that there are other solutions for this besides domDocument like DomHTMlDocument and others but i'd p开发者_如何学Crefer to work a solution with DomDocument.

thanks!


Have you tried a solution such as http://refactormycode.com/codes/708-innerhtml-of-a-domelement ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号