Saxon-HE 9.7:"no base URI is available" 错误,当尝试 运行 从 bash 查询字符串时
Saxon-HE 9.7: "no base URI is available" error, when trying to run query string from bash
根据撒克逊 documentation,
java net.sf.saxon.Query -qs:doc('a.xml')//p1 selects elements within
the file a.xml in the current directory.
我正在尝试从 bash 脚本中做到这一点:
java net.sf.saxon.Query -qs:doc"('myFile.xml')"/rootElt/@myAtt
但是,我收到以下错误:XTDE1162: Relative URI passed to document() function (myFile.xml); but no base URI is available
根据文档,这不应该发生:
The static base URI (used when calling the doc() function) is the
current directory.
我试过使用绝对 URI,但令人惊讶的是,我仍然收到完全相同的错误消息。
我需要一些帮助吗?
已解决。传递查询字符串时,没有基本 URI(文件系统中没有包含查询的资源),因此传递一个 resolve-uri()
作为第二个参数:
-qs:"doc(resolve-uri('myFile.xml', 'file:$PWD/'))/rootElt/@myAtt/xs:string(.)"
在我看来,Saxonica 应该使用此详细信息更新命令行选项 -qs
的文档(您可能需要一段时间才能自己弄清楚)。
根据撒克逊 documentation,
java net.sf.saxon.Query -qs:doc('a.xml')//p1 selects elements within the file a.xml in the current directory.
我正在尝试从 bash 脚本中做到这一点:
java net.sf.saxon.Query -qs:doc"('myFile.xml')"/rootElt/@myAtt
但是,我收到以下错误:XTDE1162: Relative URI passed to document() function (myFile.xml); but no base URI is available
根据文档,这不应该发生:
The static base URI (used when calling the doc() function) is the current directory.
我试过使用绝对 URI,但令人惊讶的是,我仍然收到完全相同的错误消息。
我需要一些帮助吗?
已解决。传递查询字符串时,没有基本 URI(文件系统中没有包含查询的资源),因此传递一个 resolve-uri()
作为第二个参数:
-qs:"doc(resolve-uri('myFile.xml', 'file:$PWD/'))/rootElt/@myAtt/xs:string(.)"
在我看来,Saxonica 应该使用此详细信息更新命令行选项 -qs
的文档(您可能需要一段时间才能自己弄清楚)。