Do not trim trailing whitespace in XML submitted by the user, e.g. for XRechnung Skonto in PaymenttermsDescription

This commit is contained in:
jstaerk
2021-11-16 21:07:04 +01:00
parent 099ce840d1
commit 63f33cabc7
3 changed files with 6 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
protected byte[] zugferdData;
private String paymentTermsDescription;
protected Profile profile = Profiles.getByName("COMFORT", 1);
protected Profile profile = Profiles.getByName("COMFORT", 1);
/**
@@ -93,6 +93,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
}
try {
final OutputFormat format = OutputFormat.createPrettyPrint();
format.setTrimText(false);
final XMLWriter writer = new XMLWriter(sw, format);
writer.write(document);
res = sw.toString().getBytes("UTF-8");
@@ -439,7 +440,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
if (dueDate != null) {
paymentTermsXml += "<ram:DueDateDateTime>";
paymentTermsXml += DATE.udtFormat(dueDate) ;
paymentTermsXml += DATE.udtFormat(dueDate);
paymentTermsXml += "</ram:DueDateDateTime>";
}
@@ -454,7 +455,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
if (discountTerms.getBaseDate() != null) {
final Date baseDate = discountTerms.getBaseDate();
paymentTermsXml += "<ram:BasisDateTime>";
paymentTermsXml += DATE.udtFormat(baseDate) ;
paymentTermsXml += DATE.udtFormat(baseDate);
paymentTermsXml += "</ram:BasisDateTime>";
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"

View File

@@ -89,6 +89,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
try {
final OutputFormat format = OutputFormat.createPrettyPrint();
format.setTrimText(false);
final XMLWriter writer = new XMLWriter(sw, format);
writer.write(document);
res = sw.toString().getBytes("UTF-8");