java - 如何设置 javax.xml.transform.TransformerFactory 系统属性

标签 java xslt-1.0 xsl-fo xalan

我正在使用 javax.xml.transform.Transform 将 XML 文件转换为 PDF。这本身就可以正常工作,但项目的某些部分正在使用 Xalan,它实现了自己的 TransformerFactory,其中的某些内容不适用于 Cyrillic。

我在 https://xml.apache.org/xalan-j/usagepatterns.html 找到了有一个属性用于定义使用的工厂:

TransformerFactory is an abstract class with a static newInstance() method that instantiates the concrete subclass designated by the javax.xml.transform.TransformerFactory system property.

The default setting for this system property is org.apache.xalan.processor.TransformerFactoryImpl.

我的问题是:如何将此属性设置为不使用 Xalan?

最佳答案

尝试将其设置为java参数-Djavax.xml.transform.TransformerFactory=<factory class>

您还可以直接在程序中将所需的工厂实例化为 TransformerFactory tf = new SomeTransformerFactoryImpl();

关于java - 如何设置 javax.xml.transform.TransformerFactory 系统属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53629927/

相关文章:

java - 在 JRE 1.7.4+ 中扩展 SocketChannel

xml - XSLT - XML 转换和删除空标记

xml - XSLT 1.0 : ignore all unmatched elements of template

xml - 使用 XSLT 基于父字段的嵌套分组

xslt - xsl-fo 填充如何应用于其他 block ?

java - 在weblogic上安装seam时出现问题

java - 如何按特定顺序重复一个过程?

java - 如何在 Java 中将声音文件表示为字节数组

xsl-fo - 从嵌入式 SVG 设置 XSL FO 背景图像

java - fo :data-cell overflow