From 66bb3c4341ea1e9ca13daa287571962a88b4ccc4 Mon Sep 17 00:00:00 2001 From: Kemal Taskin Date: Wed, 6 Nov 2024 11:06:23 +0100 Subject: [PATCH] Improve toFOP method: Parameterize the input stream and the EStandard input --- .../mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java index b2e47e3c..64e14fc3 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java @@ -249,6 +249,12 @@ protected String toFOP(String xmlFilename) EStandard theStandard = findOutStandardFromRootNode(fis); fis = new FileInputStream(xmlFilename);//rewind :-( + return toFOP(fis, theStandard); + } + + protected String toFOP(InputStream is, EStandard theStandard) + throws FileNotFoundException, TransformerException { + try { if (mXsltPDFTemplate == null) { mXsltPDFTemplate = mFactory.newTemplates( @@ -263,11 +269,11 @@ protected String toFOP(String xmlFilename) //zf2 or fx if (theStandard == EStandard.facturx) { - applyZF2XSLT(fis, iaos); + applyZF2XSLT(is, iaos); } else if (theStandard == EStandard.ubl) { - applyUBL2XSLT(fis, iaos); + applyUBL2XSLT(is, iaos); } else if (theStandard == EStandard.ubl_creditnote) { - applyUBLCreditNote2XSLT(fis, iaos); + applyUBLCreditNote2XSLT(is, iaos); }