gpt4 book ai didi

java - SaxonParserTest 缺少 SaxonXQDataSource?

转载 作者:行者123 更新时间:2023-12-02 01:43:47 30 4
gpt4 key购买 nike

希望运行 simplest使用 saxon 的可能示例,特别是 Saxon-HE:

thufir@dur:~/NetBeansProjects/helloWorldSaxon$ 
thufir@dur:~/NetBeansProjects/helloWorldSaxon$ gradle clean run

> Task :compileJava FAILED
/home/thufir/NetBeansProjects/helloWorldSaxon/src/main/java/helloWorldSaxon/App.java:6: error: package com.saxonica.xqj does not exist
import com.saxonica.xqj.SaxonXQDataSource;
^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
2 actionable tasks: 2 executed
thufir@dur:~/NetBeansProjects/helloWorldSaxon$

我认为这不是正确的导入声明,但我也不确定什么是正确的。仔细观察示例就会发现它正在使用 saxonica 并且实际上注释掉了导入:

//import net.sf.saxon.xqj.SaxonXQDataSource;

重申一下,希望留在 Saxon-HE 内。但如何呢?

来自build文件:

compile (group = "net.sf.saxon"            , name = "Saxon-HE"    , version = "9.9.0-2")

坚持使用 Saxon-HE 这是正确的导入吗?

它附带哪个数据源?

thufir@dur:~/saxon$ 
thufir@dur:~/saxon$ jar tf Saxon-HE.jar | grep data
net/sf/saxon/data/
net/sf/saxon/data/analyze-string.xsd
net/sf/saxon/data/casevariants.xml
net/sf/saxon/data/categories.xml
net/sf/saxon/data/chameleon.xsl
net/sf/saxon/data/json.xsd
net/sf/saxon/data/normalizationData.xml
net/sf/saxon/data/override.xsl
net/sf/saxon/data/unicodeBlocks.xml
net/sf/saxon/data/xml-to-json-indent.xsl
net/sf/saxon/data/xml-to-json-pkg.xsl
net/sf/saxon/data/xml-to-json.xsl
net/sf/saxon/data/xpath-functions.scm
net/sf/saxon/data/xpath-functions.xsd
net/sf/saxon/resource/MetadataResource$1.class
net/sf/saxon/resource/MetadataResource.class
thufir@dur:~/saxon$

我需要更多编译依赖项吗?如果有,是哪些?

最佳答案

SaxonXQDataSource 位于包 com.saxonica.xqj 中。如果您使用 Saxon-HE,则需要在类路径中包含 JAR 文件 saxon9-xqj.jar

Saxon 的 XQJ 库与 Saxon-HE 的其他库受到不同对待的原因是许可不同。 XQJ 接口(interface)是由 Oracle 发布的,Oracle 声称其实现受到 Oracle 许可条件的约束(有些人质疑实现已发布的 API 需要许可证,但这是律师的事)。 Oracle 许可条件不符合开源许可的公认标准(原因有两个:(a) 它们不允许修改,(b) 它们要求实现才能通过所有引用测试)。因此,一些重新分发 Saxon-HE 的软件公司更愿意将 XQJ 从分发中排除,为了简化此操作,我们将 XQJ 类放在单独的 JAR 文件中。

关于java - SaxonParserTest 缺少 SaxonXQDataSource?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54030935/

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