Skip to content

Duplicate InvoiceReferencedDocument elements in corrected XRechnung (TypeCode 384) with invoice.setCorrection() #748

@thomasweitzel

Description

@thomasweitzel

When generating XML files with the Mustangproject v2.16.2 and using setCorrection on the invoice, I get an invalid XML.

A Java fragment:

Invoice invoice = new Invoice();
/*using some setters except `setCorrection` */
invoice.setCorrection("test-123");

Excerpt from the generated XML file (the element InvoiceReferencedDocument appears twice with the same contents):

<ram:InvoiceReferencedDocument>
    <ram:IssuerAssignedID>test-123</ram:IssuerAssignedID>
</ram:InvoiceReferencedDocument>
<ram:InvoiceReferencedDocument>
    <ram:IssuerAssignedID>test-123</ram:IssuerAssignedID>
</ram:InvoiceReferencedDocument>

The XML is generated like this:

ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
zf2p.setProfile(Profiles.getByName("XRechnung", 3));
zf2p.generateXML(invoice);
String theXML = new String(zf2p.getXML());

I'm using Java-22, but the problem is present with Java-21 (LTS), too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions