small possible nullpointerex fix (for accidental non-pdf/a-PDFs), new test
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
- support pdf export/visualization to PDF, thanks to Heavenfighter #387 allow embedd fonts from jar-file for pdf creation #388
|
||||||
|
- Fix #389: ClassCastException: ZUGFeRDExporterFromA3
|
||||||
|
|
||||||
2.11.0
|
2.11.0
|
||||||
=======
|
=======
|
||||||
2024-05-22
|
2024-05-22
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ public class ZUGFeRDImporter {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
final List<PDNameTreeNode<PDComplexFileSpecification>> kids = etn.getKids();
|
final List<PDNameTreeNode<PDComplexFileSpecification>> kids = etn.getKids();
|
||||||
|
if (kids == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (final PDNameTreeNode<PDComplexFileSpecification> node : kids) {
|
for (final PDNameTreeNode<PDComplexFileSpecification> node : kids) {
|
||||||
final Map<String, PDComplexFileSpecification> namesL = node.getNames();
|
final Map<String, PDComplexFileSpecification> namesL = node.getNames();
|
||||||
extractFiles(namesL);
|
extractFiles(namesL);
|
||||||
|
|||||||
@@ -258,4 +258,30 @@ public class XMLValidatorTest extends ResourceCase {
|
|||||||
assertTrue(noExceptions);
|
assertTrue(noExceptions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testUBLValidation() {
|
||||||
|
ValidationContext ctx = new ValidationContext(null);
|
||||||
|
XMLValidator xv = new XMLValidator(ctx);
|
||||||
|
XPathEngine xpath = new JAXPXPathEngine();
|
||||||
|
|
||||||
|
boolean noExceptions = true;
|
||||||
|
File tempFile = getResourceAsFile("EN16931_Einfach.ubl.xml");
|
||||||
|
try {
|
||||||
|
xv.setFilename(tempFile.getAbsolutePath());
|
||||||
|
xv.validate();
|
||||||
|
|
||||||
|
Source source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
|
||||||
|
String content = xpath.evaluate("/validation/summary/@status", source);
|
||||||
|
assertEquals("valid", content);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (IrrecoverableValidationError e) {
|
||||||
|
|
||||||
|
noExceptions = false;
|
||||||
|
}
|
||||||
|
assertTrue(noExceptions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
159
validator/src/test/resources/EN16931_Einfach.ubl.xml
Normal file
159
validator/src/test/resources/EN16931_Einfach.ubl.xml
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
|
||||||
|
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
|
||||||
|
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
|
||||||
|
<cbc:ID>471102</cbc:ID>
|
||||||
|
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||||
|
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||||
|
<cbc:Note>Rechnung gemäß Bestellung vom 01.03.2018.</cbc:Note>
|
||||||
|
<cbc:Note>#REG#Lieferant GmbH
|
||||||
|
Lieferantenstraße 20
|
||||||
|
80333 München
|
||||||
|
Deutschland
|
||||||
|
Geschäftsführer: Hans Muster
|
||||||
|
Handelsregisternummer: H A 123
|
||||||
|
</cbc:Note>
|
||||||
|
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||||
|
<cac:AccountingSupplierParty>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyIdentification>
|
||||||
|
<cbc:ID schemeID="0088">4000001123452</cbc:ID>
|
||||||
|
</cac:PartyIdentification>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PostalAddress>
|
||||||
|
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||||
|
<cbc:CityName>München</cbc:CityName>
|
||||||
|
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PostalAddress>
|
||||||
|
<cac:PartyTaxScheme>
|
||||||
|
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>FC</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:PartyTaxScheme>
|
||||||
|
<cac:PartyTaxScheme>
|
||||||
|
<cbc:CompanyID>DE123456789</cbc:CompanyID>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>VAT</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:PartyTaxScheme>
|
||||||
|
<cac:PartyLegalEntity>
|
||||||
|
<cbc:RegistrationName>Lieferant GmbH</cbc:RegistrationName>
|
||||||
|
</cac:PartyLegalEntity>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingSupplierParty>
|
||||||
|
<cac:AccountingCustomerParty>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyIdentification>
|
||||||
|
<cbc:ID>GE2020211</cbc:ID>
|
||||||
|
</cac:PartyIdentification>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PostalAddress>
|
||||||
|
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||||
|
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||||
|
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:PostalAddress>
|
||||||
|
<cac:PartyLegalEntity>
|
||||||
|
<cbc:RegistrationName>Kunden AG Mitte</cbc:RegistrationName>
|
||||||
|
</cac:PartyLegalEntity>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingCustomerParty>
|
||||||
|
<cac:Delivery>
|
||||||
|
<cbc:ActualDeliveryDate>2018-03-05</cbc:ActualDeliveryDate>
|
||||||
|
</cac:Delivery>
|
||||||
|
<cac:PaymentTerms>
|
||||||
|
<cbc:Note>Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018</cbc:Note>
|
||||||
|
</cac:PaymentTerms>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cbc:TaxAmount currencyID="EUR">56.87</cbc:TaxAmount>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cbc:TaxableAmount currencyID="EUR">275</cbc:TaxableAmount>
|
||||||
|
<cbc:TaxAmount currencyID="EUR">19.25</cbc:TaxAmount>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cbc:ID>S</cbc:ID>
|
||||||
|
<cbc:Percent>7</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>VAT</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cbc:TaxableAmount currencyID="EUR">198</cbc:TaxableAmount>
|
||||||
|
<cbc:TaxAmount currencyID="EUR">37.62</cbc:TaxAmount>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cbc:ID>S</cbc:ID>
|
||||||
|
<cbc:Percent>19</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>VAT</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:LegalMonetaryTotal>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">473</cbc:LineExtensionAmount>
|
||||||
|
<cbc:TaxExclusiveAmount currencyID="EUR">473</cbc:TaxExclusiveAmount>
|
||||||
|
<cbc:TaxInclusiveAmount currencyID="EUR">529.87</cbc:TaxInclusiveAmount>
|
||||||
|
<cbc:AllowanceTotalAmount currencyID="EUR">0</cbc:AllowanceTotalAmount>
|
||||||
|
<cbc:ChargeTotalAmount currencyID="EUR">0</cbc:ChargeTotalAmount>
|
||||||
|
<cbc:PrepaidAmount currencyID="EUR">0</cbc:PrepaidAmount>
|
||||||
|
<cbc:PayableAmount currencyID="EUR">529.87</cbc:PayableAmount>
|
||||||
|
</cac:LegalMonetaryTotal>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>1</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">198</cbc:LineExtensionAmount>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Name>Trennblätter A4</cbc:Name>
|
||||||
|
<cac:SellersItemIdentification>
|
||||||
|
<cbc:ID>TB100A4</cbc:ID>
|
||||||
|
</cac:SellersItemIdentification>
|
||||||
|
<cac:StandardItemIdentification>
|
||||||
|
<cbc:ID schemeID="0160">4012345001235</cbc:ID>
|
||||||
|
</cac:StandardItemIdentification>
|
||||||
|
<cac:ClassifiedTaxCategory>
|
||||||
|
<cbc:ID>S</cbc:ID>
|
||||||
|
<cbc:Percent>19</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>VAT</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:ClassifiedTaxCategory>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="EUR">9.9</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>2</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity unitCode="H87">50</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="EUR">275</cbc:LineExtensionAmount>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Name>Joghurt Banane</cbc:Name>
|
||||||
|
<cac:SellersItemIdentification>
|
||||||
|
<cbc:ID>ARNR2</cbc:ID>
|
||||||
|
</cac:SellersItemIdentification>
|
||||||
|
<cac:StandardItemIdentification>
|
||||||
|
<cbc:ID schemeID="0160">4000050986428</cbc:ID>
|
||||||
|
</cac:StandardItemIdentification>
|
||||||
|
<cac:ClassifiedTaxCategory>
|
||||||
|
<cbc:ID>S</cbc:ID>
|
||||||
|
<cbc:Percent>7</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>VAT</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:ClassifiedTaxCategory>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>
|
||||||
|
</Invoice>
|
||||||
Reference in New Issue
Block a user