gpt4 book ai didi

java - String javax.xml.xpath.XPathExpression.evaluate(Object item) 保证它在所有实现中都不会返回 null?

转载 作者:行者123 更新时间:2023-11-30 07:38:22 25 4
gpt4 key购买 nike

来自JavaDoc : 返回:字符串,它是计算表达式并将结果转换为字符串的结果。

/**
* ...
* ...
* @return The <code>String</code> that is the result of evaluating the expression and converting the result to a
* <code>String</code>.
* ...
* ...
*/
String javax.xml.xpath.XPathExpression.evaluate(Object item)

问题是,如果表达式找不到任何内容,这里的契约(Contract)是什么有点模糊。 null 在所有实现中都是有效/无效的返回值吗?返回API在哪里定义?在 JSR 中?

最佳答案

如果我没记错的话,XPath 中没有 null 这样的东西。我猜它会返回空字符串。

更新:快速浏览XPath 2.0XPath 2.0 Functions规范证实了这种感觉。

关于java - String javax.xml.xpath.XPathExpression.evaluate(Object item) 保证它在所有实现中都不会返回 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1985234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com