Is there a way to get a string representation of ancestors with QueryPath or DOM?

StackOverflow https://stackoverflow.com/questions/8525114

  •  17-03-2021
  •  | 
  •  

質問

Something like:

find node: qp( $doc, 'UniqueSubNode' );

string representation: Root>Node>InnerNode>UniqueSubNode
役に立ちましたか?

解決

In QP parents() will get you all the ancestors, then all you need to do is html() each of them, I hope it helps.

Refer to this: http://api.querypath.org/docs/class_query_path.html#aae3c29dfc81839c3c054e7d608facd76

他のヒント

Assuming your server allows you to use it you could use the DOMDocument object.

http://php.net/manual/en/class.domdocument.php

The DOMDocument object works in a fairly similar method to javascript's DOM manipulations. The text value is stored in the object's textContent member.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top