phax / ph-ubl

Java library for reading and writing UBL 2.0, 2.1, 2.2, 2.3 and 2.4 (CS01) documents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating Empty UBL Extensions

byzeagle opened this issue · comments

I need to create something like,

 <ext:UBLExtensions>
    <ext:UBLExtension>
       <ext:ExtensionContent>
       </ext:ExtensionContent>
    </ext:UBLExtension>
 </ext:UBLExtensions>

with UBL2.1. However, I am not able to create such a declaration. The library always gives an error saying that ext:ExtensionContet is incomplete. But I need this exact declaration. How do I do that?

See the previous commit. It creates an exampe file with this layout:

<?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">
  <cec:UBLExtensions>
    <cec:UBLExtension>
      <cec:ExtensionContent />
    </cec:UBLExtension>
  </cec:UBLExtensions>
  <cbc:ID>Dummy Invoice number</cbc:ID>
  <cbc:IssueDate>2021-06-22Z</cbc:IssueDate>
  <cac:AccountingSupplierParty />
  <cac:AccountingCustomerParty />
  <cac:LegalMonetaryTotal>
    <cbc:PayableAmount currencyID="EUR">10</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
      <cbc:LineExtensionAmount currencyID="EUR">10</cbc:LineExtensionAmount>
      <cac:Item />
  </cac:InvoiceLine>
</Invoice>

They key call for you is .setUseSchema (false)

Thanks for your help. Great work. Keep it up!