diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java
index 2f6269b9..0c31afe6 100644
--- a/library/src/main/java/org/mustangproject/Item.java
+++ b/library/src/main/java/org/mustangproject/Item.java
@@ -70,7 +70,7 @@ public class Item implements IZUGFeRDExportableItem {
// Bharti's homework 20241126:Streams https://www.youtube.com/watch?v=Lf01cBzmuXw
// and Lambdas https://www.youtube.com/watch?v=HCyx31NW8xg
- setProduct(new Product());
+ setProduct(new Product(itemMap.getNode("Item").get()));
icnm.getAsString("Name").ifPresent(product::setName);
icnm.getAsString("Description").ifPresent(product::setDescription);
@@ -111,14 +111,19 @@ public class Item implements IZUGFeRDExportableItem {
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());
});
+ itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
+ .forEach(this::addReferencedDocument);
+
+ // ubl
+
itemMap.getAsNodeMap("OrderLineReference")
+ // ubl
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
.ifPresent(this::addReferencedLineID);
- itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
- .forEach(this::addAdditionalReference);
+
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
@@ -131,8 +136,8 @@ public class Item implements IZUGFeRDExportableItem {
npptpNodes.getAsBigDecimal("BasisQuantity").ifPresent(this::setBasisQuantity);
});
- icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode)
- .forEach(this::addReferencedDocument);
+ icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).
+ forEach(this::addReferencedDocument);
});
itemMap.getNode("SpecifiedTradeProduct").map(Product::new).ifPresent(this::setProduct);//CII
diff --git a/library/src/main/java/org/mustangproject/Product.java b/library/src/main/java/org/mustangproject/Product.java
index 1537bae4..83cf4543 100644
--- a/library/src/main/java/org/mustangproject/Product.java
+++ b/library/src/main/java/org/mustangproject/Product.java
@@ -80,6 +80,7 @@ public class Product implements IZUGFeRDExportableProduct {
}
});
+
//UBL
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
String name = aipNodes.getAsStringOrNull("Name");
@@ -92,6 +93,13 @@ public class Product implements IZUGFeRDExportableProduct {
}
});
+ nodeMap.getAsNodeMap("CommodityClassification").ifPresent(dpcNodes -> {
+ String className = dpcNodes.getAsStringOrNull("ClassName");
+ dpcNodes.getNode("ItemClassificationCode").map(ClassCode::fromNode).ifPresent(classCode ->
+ classifications.add(new DesignatedProductClassification(classCode, className)));
+ });
+
+ //UBL
nodeMap.getAsNodeMap("DesignatedProductClassification").ifPresent(dpcNodes -> {
String className = dpcNodes.getAsStringOrNull("ClassName");
dpcNodes.getNode("ClassCode").map(ClassCode::fromNode).ifPresent(classCode ->
@@ -132,6 +140,7 @@ public class Product implements IZUGFeRDExportableProduct {
return this;
}
+
/***
*
* @return e.g. intra-commnunity supply or small business
diff --git a/library/src/main/java/org/mustangproject/ReferencedDocument.java b/library/src/main/java/org/mustangproject/ReferencedDocument.java
index 4d2151ca..737082d6 100644
--- a/library/src/main/java/org/mustangproject/ReferencedDocument.java
+++ b/library/src/main/java/org/mustangproject/ReferencedDocument.java
@@ -22,7 +22,7 @@ public class ReferencedDocument implements IReferencedDocument {
this.referenceTypeCode = referenceTypeCode;
}
- /***
+ /***
* sets an ID assigned by the sender
* @param issuerAssignedID the ID as a string :-)
*/
diff --git a/library/src/main/java/org/mustangproject/TradeParty.java b/library/src/main/java/org/mustangproject/TradeParty.java
index 1ae7b2e9..577b9223 100644
--- a/library/src/main/java/org/mustangproject/TradeParty.java
+++ b/library/src/main/java/org/mustangproject/TradeParty.java
@@ -226,9 +226,10 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
if (currentTopElementName.equals("PartyLegalEntity")) {
NodeList legal = party.item(partyIndex).getChildNodes();
+ LegalOrganisation lo = null;
for (int legalChildIndex = 0; legalChildIndex < legal.getLength(); legalChildIndex++) {
if (legal.item(legalChildIndex).getLocalName() != null) {
- LegalOrganisation lo = null;
+
if (legal.item(legalChildIndex).getLocalName().equals("RegistrationName")) {
if (lo == null) {
lo = new LegalOrganisation();
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
index 36bfaf23..951076c8 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
@@ -381,7 +381,7 @@ public class ZUGFeRDInvoiceImporter {
xpr = xpath.compile("//*[local-name()=\"BuyerTradeParty\"]|//*[local-name()=\"AccountingCustomerParty\"]/*");
NodeList BuyerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
- xpr = xpath.compile("//*[local-name()=\"PayeeTradeParty\"]|//*[local-name()=\"PayeeParty\"]//*");
+ xpr = xpath.compile("//*[local-name()=\"PayeeTradeParty\"]|//*[local-name()=\"PayeeParty\"]/*");
NodeList payeeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
xpr = xpath.compile("//*[local-name()=\"ExchangedDocument\"]|//*[local-name()=\"HeaderExchangedDocument\"]");
diff --git a/library/src/test/resources/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml b/library/src/test/resources/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml
index b9b5abd7..6e850cc1 100644
--- a/library/src/test/resources/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml
+++ b/library/src/test/resources/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml
@@ -65,9 +65,6 @@
Seller identifier 2
-
- Bank assigned creditor identifier
-
Seller trading name