如何在 Saxon 中最好地转义 SQL

问题描述 投票:0回答:1
saxon
1个回答
0
投票

使用 Saxon-PE 或 -EE,您可以直接从 XPath 表达式调用 Java 方法。这些被称为“自反扩展函数”,并在 https://www.saxonica.com/documentation12/index.html#!extensibility/extension-functions-J/reflexive-functions

进行了描述。

我还没有设法追踪

org.apache.commons.lang.StringEscapeUtils.escapeSql()
的规范,但如果它是一个简单的静态方法,采用字符串参数并返回字符串结果,那么你可以将其称为:

select="$field-value => Q{java:org.apache.commons.lang.StringEscapeUtils}escapeSql()"/>

如果您想使用开源 Saxon-HE 来做到这一点,那么您将需要跳过更多的麻烦并编写一些 Java 包装器代码:所有内容都在

进行了解释

https://www.saxonica.com/documentation12/index.html#!extensibility/extension-functions-J/ext-simple-J

© www.soinside.com 2019 - 2024. All rights reserved.