[英]Apache FOP and Oracle BI Publisher Template compatibility issue
我已經使用用於Microsoft Word的Oracle BI Publisher外接程序創建了XSL-FO模板,我想使用FOP對其進行轉換,並將其導出為PDF文件。
從Oracle命名空間中發現第一個標記后,轉換操作失敗,並且錯誤消息顯示:
(Location of error unknown)org.apache.fop.fo.ValidationException: Invalid property encountered on "fo:root": xdofo:nf-separator (No context info available)
這是代碼:
FopFactory fopFactory = FopFactory.newInstance();
out = new BufferedOutputStream(new FileOutputStream(new File("result.pdf")));
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
StreamSource source = new StreamSource(generateOrderInvoiceXml(orderId));
StreamSource transformSource = new StreamSource(new File("template.xsl"));
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(transformSource);
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(source, res);
有沒有一種使用FOP轉換這種模板的方法?
為了防止FOP阻塞未知的專有屬性,請禁用嚴格的驗證:
fopFactory.setStrictValidation(false);
參考: http : //xmlgraphics.apache.org/fop/1.1/embedding.html#fop-factory 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.