我正在使用 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/