ZF1 backward compatbility on export
This commit is contained in:
@@ -301,6 +301,17 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
PDFAttachGenericFile(doc, filename, "Alternative",
|
PDFAttachGenericFile(doc, filename, "Alternative",
|
||||||
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
||||||
"text/xml", xmlProvider.getXML());
|
"text/xml", xmlProvider.getXML());
|
||||||
|
|
||||||
|
if (ZFVersion>1) {
|
||||||
|
// Also attach a ZF1 file for backward compatibility
|
||||||
|
setZUGFeRDVersion(1);
|
||||||
|
xmlProvider.generateXML(trans);
|
||||||
|
filename = getFilenameForVersion(ZFVersion);
|
||||||
|
PDFAttachGenericFile(doc, filename, "Alternative",
|
||||||
|
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
||||||
|
"text/xml", xmlProvider.getXML());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(String ZUGFeRDfilename) throws IOException {
|
public void export(String ZUGFeRDfilename) throws IOException {
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ import java.util.Map;
|
|||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.xpath.XPath;
|
||||||
|
import javax.xml.xpath.XPathConstants;
|
||||||
|
import javax.xml.xpath.XPathExpression;
|
||||||
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
|
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
|
||||||
@@ -173,6 +177,20 @@ public class ZUGFeRDImporter {
|
|||||||
* </ram:PayeeSpecifiedCreditorFinancialInstitution>
|
* </ram:PayeeSpecifiedCreditorFinancialInstitution>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/***
|
||||||
|
* we should switch to xpath like this
|
||||||
|
// Create XPathFactory object
|
||||||
|
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||||
|
|
||||||
|
// Create XPath object
|
||||||
|
XPath xpath = xpathFactory.newXPath();
|
||||||
|
XPathExpression expr =
|
||||||
|
xpath.compile("//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/[local-name()=\"ID\"]");
|
||||||
|
//evaluate expression result on XML document
|
||||||
|
ndList = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
ndList = document.getElementsByTagNameNS("*", "PayeePartyCreditorFinancialAccount"); //$NON-NLS-1$
|
ndList = document.getElementsByTagNameNS("*", "PayeePartyCreditorFinancialAccount"); //$NON-NLS-1$
|
||||||
for (int bookingIndex = 0; bookingIndex < ndList.getLength(); bookingIndex++) {
|
for (int bookingIndex = 0; bookingIndex < ndList.getLength(); bookingIndex++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user