code4craft / code4craft/xsoup

Improvement: Xsoup should return xpath attribute matches using getElements() method

Open
#17 0 comments 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

At this time, i have to match against a regex rule to decide wich method should be used (wether it's an attribute xpath query or not). I think the getElements() method should also match against attribute xpath queries, this would be a fine improvement.

if (query.matches("(.*/@.*)")) {
            String result = Xsoup.compile(query).evaluate(document).get();
            matches.add(result);
} else {
            Elements results = Xsoup.compile(query).evaluate(document).getElements();
             // following more code wich adds the results to the matches list...
}

Best regards

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 the Xsoup.compile(query).evaluate(document).getElements() entry point and compare its behavior with the attribute-query path shown in the issue. Confirm that attribute XPath queries return matches through getElements() while existing element queries remain unchanged; the payload names no files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.