简体   繁体   中英

How can I get text without links?

I have some div with text and links.

<div id="mydiv">
some text <a href="#">super link</a> la la la
</div>

I need to get output with xPath:

some text la la la

Is it possible?

Yes, you want that string value of the div :

string(//div[@id="mydiv"])

will return

some text la la la

as requested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM