Do not strip \n from XML field on out.put()

32 views
Skip to first unread message

Alexander

unread,
Jun 29, 2021, 5:22:30 AMJun 29
to Bots Open Source EDI Translator
Hello,

for the German XRechnung format it is necessary to have a line break (\n) at the end of a XML field.

The payment terms have to be stated like this now since XRechnung version 2.0.1:
Screenshot 2021-06-29 111706.png

Before (<= XRechnung 2.0.0) this was fine:
Screenshot 2021-06-29 111831.png

Unfortunately Bots automatically strips \n from the string in out.put().
Is there any way to prevent that?
Or do I have to create a routescript (postprocessing) for every XRechnung route (I have a lot of them)?

Thanks in advance!

Best regards
Alexander

Henk-Jan Ebbers

unread,
Jun 29, 2021, 2:01:13 PMJun 29
to bots...@googlegroups.com
there is no such switch.
so it is not a default option to do this.....might be that postprocessing is an option.
(who in heavens name makes cr/lf significant in edi?)
kind regards,
Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/cd72a155-e2e9-4861-8b09-907f524b072cn%40googlegroups.com.

Alexander

unread,
Jun 30, 2021, 10:37:16 AMJun 30
to Bots Open Source EDI Translator
Well.
The German government does, or rather the guy there who is responsible for the XRechnung specifications. 🤷‍♂️

Anyhow, I will use a simple postprocess then.
tofile.write(infile.read().replace('#</cbc:Note>','#\n</cbc:Note>'))


Thanks & best regards
Alexander

Eppye Bots

unread,
Jun 30, 2021, 12:02:41 PMJun 30
to 'Chuck Turco' via Bots Open Source EDI Translator
so....what is he going to do with the CR/LF ?


kind regards, Henk-Jan Ebbers


Alexander

unread,
Jun 30, 2021, 12:47:20 PMJun 30
to Bots Open Source EDI Translator
Basically nothing I would say.

The background is the specification of the field PaymentTerms>>Note which can contain one or multiple skonto payment terms in this format (as you saw in the screenshots of my first post):
#SKONTO#TAGE=14#PROZENT=2.00#

The specification says (freely translated by me):
"Each skonto term starts with a #, the single parts of the skonto term are separated with a # and each skonto term ends with a #.
At the very end of a complete skonto term needs to be a XML compliant line break"

According to the wording of the specification there needs to be a line break even if it is technically totally unnecessary.
And with the newest version of the official validator application released alongside the updated 2.0.1 specification this is now also strictly checked and hence I needed to change it.

The PaymentTerms>>Note field is totally stupid anyhow in my opinion because why would you not just do somethink like this?!

<PaymentTerms>
        <PaymentTerm>
                <DueDays>21</DueDays>
                <DueDate>28.06.2021</DueDate>
                <DiscountPercentage>3,00</DiscountPercentage>
        </PaymentTerm>
        <PaymentTerm>
                <DueDays>60</DueDays>
                <DueDate>06.08.2021</DueDate>
                <DiscountPercentage/>
        </PaymentTerm>
</PaymentTerms>

This would make much more sense in a XML format.


Best regards
Alexander

Wassily

unread,
Jul 9, 2021, 2:40:18 AMJul 9
to Bots Open Source EDI Translator
Hi Alexander

Understand that this was a free translation, but assume that "XML Compliant line Break" is really what is stated in German, then a \n is not correct, but you should put in &#13; instead. Check here:
https://stackoverflow.com/questions/2265966/xml-carriage-return-encoding
I have not tried it to write this in BOTS yet, but when consuming XML and line breaks are important for whatever reason, then I do enforce this practice with sending systems and BOTS handles them correctly on incoming.

Greets
Wassily
Reply all
Reply to author
Forward
0 new messages