ZUGFeRD-csharp: XRechnung UBL PaymentTerms with LineBreak

Should the UBL-Writer respect Business Rules?

image

So it should look like

  <cac:PaymentTerms>
    <cbc:Note>
      #SKONTO#TAGE=14#PROZENT=0.00#BASISBETRAG=219.80#
    </cbc:Note>
  </cac:PaymentTerms>

and the actual implementation produces:

  <cac:PaymentTerms>
    <cbc:Note>#SKONTO#TAGE=14#PROZENT=0.00#BASISBETRAG=219.80#</cbc:Note>
  </cac:PaymentTerms>

If I add a verbatim string with line break at the beginning and end, the result looks like

  <cac:PaymentTerms>
    <cbc:Note>
#SKONTO#TAGE=14#PROZENT=0.00#BASISBETRAG=219.80#</cbc:Note>
  </cac:PaymentTerms>

So the line break at the end is ignored.

Do you think this is a thing? Is the Writer used able to produce this?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (23 by maintainers)

Most upvoted comments

What I painfully noticed is that the sequence of elements is of importance which led to the weird way of implementation in the CII writer regarding the DueDate.

Um, OK. 😃 Not that I would be bothered about indentation as it is XML, and primarily machine-read.

I get the point though, although it is not a technical constraint but optics for the eyes. Any XML viewer has a “beautify XML” feature.

I’d rather would have an option to completely avoid indentation and produces linear, minified XML output. Hence, we have visualizer or renderer to display the XML content for humans.

Cheers, JoKi

it appeared to be necessary for the validator.

Hmm, interesting. I implemented that output already here:

https://github.com/stephanstapel/ZUGFeRD-csharp/blob/9279a5c66f965a77f5b017dea351f3f2d7e2d6af/ZUGFeRD/InvoiceDescriptor23CIIWriter.cs#L985-L1001

Wouldn’t that work for UBL writer?

basically yes. The new thing here is correct indention of the node content like here:

https://github.com/stephanstapel/ZUGFeRD-csharp/issues/388#issuecomment-2413207892

Just tested the CII-export and it is coming out like this (I did not insert it with a linebreak):

      <ram:SpecifiedTradePaymentTerms>
        <ram:Description>#SKONTO#TAGE=14#PROZENT=0.00#BASISBETRAG=219.80#
</ram:Description>
      </ram:SpecifiedTradePaymentTerms>

But the validator did not say anything about this. So it just does not look very good…

Without the manual indentation the result is the following:

  <cac:PaymentTerms>
    <cbc:Note>
      #SKONTO#TAGE=14#PROZENT=0.00#BASISBETRAG=209.53#
</cbc:Note>
  </cac:PaymentTerms>

Would it be possible to use the XmlStack for indention?

Surely. Then one could pass a bool that there should be an additional indentation which is 2 * this.XmlStack.Count()…