Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xsoup cannot compile valid xpath expression / ()[1] / first element #339

Closed
timactive opened this issue Jun 17, 2016 · 2 comments
Closed

Comments

@timactive
Copy link

I need only the first element for a selector (div[@Class="fh-breadcrumb"])[1]. This expression work fine in chrome browser.

page.getHtml().xpath("//(div[@class=\"fh\\-breadcrumb\"])[1]//li").nodes();

But when i try i have this exception linked to Xsoup :

org.jsoup.select.Selector$SelectorParseException: Could not parse query '(div[@Class="fh-breadcrumb"])[1]': unexpected token at '(div[@Class="fh-breadcrumb"])[1]'
at us.codecraft.xsoup.xevaluator.XPathParser.findElements(XPathParser.java:166) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.xevaluator.XPathParser.parse(XPathParser.java:76) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.xevaluator.XPathParser.parse(XPathParser.java:408) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.xevaluator.XPathParser.combinator(XPathParser.java:110) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.xevaluator.XPathParser.parse(XPathParser.java:74) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.xevaluator.XPathParser.parse(XPathParser.java:408) ~[xsoup-0.3.1.jar:na]
at us.codecraft.xsoup.Xsoup.compile(Xsoup.java:25) ~[xsoup-0.3.1.jar:na]

@timactive
Copy link
Author

dupplicate with issue code4craft/xsoup#25

@timactive timactive reopened this Jun 17, 2016
@kenti-lan
Copy link

maybe the xsoup it is implemented by himself.

@sutra sutra added this to the WebMagic-0.7.4 milestone Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants