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

自定义追加是否存在某个属性的函数,拿不到属性值与入参 #79

Open
zzllkk2003 opened this issue Mar 24, 2023 · 0 comments

Comments

@zzllkk2003
Copy link

zzllkk2003 commented Mar 24, 2023

为了便于快速识别您的问题,请认真回答以下问题,谢谢!
Please answer these questions before submitting your issue. Thanks!

  1. 使用的表达式与使用场景,确保能够复现(What did you do , If possible, provide a recipe for reproducing the error.)?
    我想实现boolean的内置函数,比如想判断 当前是否存在 某个属性,
    如//*[boolean(@foo)]
public class Boolean implements Function {
    @Override
    public String name() {
        return "boolean";
    }

    @Override
    public XValue call(Scope scope, List<XValue> params) {
        String first = params.get(0).asString();

        System.out.println(JsonUtil.toJsonString(params));
        return XValue.create(true);
    }
}

发现这个
List existsFoo=currentNode.sel("//*[boolean(@foo]");
在调试的时候,发现拿不到 当前的这个属性的上下文呀。

image

  1. 期望看到什么(What did you expect to see)?

  2. JsoupXpath给出的结果是什么(What did you see instead)?

  3. 当前使用的版本(What version of JsoupXpath are you using)?

    cn.wanghaomiao
    JsoupXpath
    2.5.3

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

1 participant