code4craft / code4craft/xsoup

Question: Xpath expression fails with Could not parse query

Open
#32 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
474
Forks
148
PR merge metrics
No merged PRs in 30d

Description

Hi, I am trying to parse the Stay Safe section at this url - http://wikitravel.org/en/San_Francisco and my xpath is //h2[span[text()='Stay safe']]/following-sibling::p//text()

When i run the xpath in Chrome dev console, it evaluates properly and returns text nodes to me. However fails in xsoup at XpathParser.byFunction() and throws
Could not parse query 'h2[span[text()='Stay safe']]': unexpected token at 'span[text()='Stay safe']'

Do you have suggestion on this? TIA.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at XpathParser.byFunction(), where the reported expression fails, and inspect how nested predicates such as span[text()='Stay safe'] are parsed. Reproduce the query from the issue and verify that it parses successfully and returns the expected text nodes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.