使用Xpath的contains函数出现问题
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 474
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
举例:https://club.autohome.com.cn/bbs/thread/86f2870bac840396/72293736-1.html
在浏览器审查元素-Console中输入
$x("//div[@class='conleft fl']/ul[@class='leftlist']/li[contains(text(),'帖子')]/a[1]/text()")
得到(7) [text, text, text, text, text, text, text]
而使用Webmagic集成的Xsoup
page.getHtml().xpath("//div[@class='conleft fl']/ul[@class='leftlist']/li[contains(text(),'帖子')]/a[1]/text()").all();
会得到一个空集合,求解
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the XPath expression against the linked Autohome page in the browser console and through WebMagic's Xsoup call. Trace how Xsoup handles contains(text(),'帖子') and compare the selected nodes; done means the Xsoup query returns the expected text nodes or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100