e-Spirit / javascript-content-api-library

Apache License 2.0
7 stars 11 forks source link

CaaSMapper | [XMLParser]: Error parsing XML whenever & is supplied #189

Closed samo4b closed 9 months ago

samo4b commented 9 months ago

We get an error whenever we try to add an & inside a CMS_INPUT_DOM element. The text is just a plain text without any styling:

image

However in the Frontend we get the following error:

CaaSMapper | [XMLParser]: Error parsing XML | {} | <div data-fs-style="format.plain">Nach diesem Satz kommt en kaufmännisches Und & mit Text danach</div> 

We do use this in the Frontend:

<FSXARichText
    v-for="(message, index) in messages"
    :key="index"
    :content="message.content"
    :data="message.data"
    :type="message.type"
/>

And inside the individual components extended by FSXABaseRichTextElement we simply use <render-content /> with a bit of styling:

image

This leads to the problem that everything from the & til the end is missing in the Frontend: image

Reference to the API (where this very likely goes wrong): XMLParser.ts#55

I suspect that the escaping with ENTITIES is not correctly applied but that is just my guess. Please have a look at it.

neo-reply-lukas commented 9 months ago

I just double checked and i cannot reproduce this problem on my side with the latest version. What Version of fsxa-api do you use? You can check what Version is used with npm list fsxa-api

jodeleit-es commented 9 months ago

This is a missing/wrong configuration in FirstSpirit. FirstSpirit should output an XML entity. Therefore you have to specify in the corresponding (or in every) format template for "conversion" a rule wich replaces these characters with their respective entities in the first channel. There is e.g. a conversion rule named "CaaS" for this.

jodeleit-es commented 9 months ago

image

samo4b commented 9 months ago

@neo-reply-lukas We are using the latest versions:

"fsxa-api": "10.18.0",
"fsxa-nuxt-module": "npm:@neo-reply/fsxa-nuxt-module@8.0.0",
"fsxa-pattern-library": "npm:@neo-reply/fsxa-pattern-library@9.1.0",

@jodeleit-es I'll try that out and see if that helps us.

samo4b commented 9 months ago

@jodeleit-es We don't have any "CaaS" Conversion on our side (but something we could try out).

image

Does this conversion really apply to the data which is then available in the CaaS?

jodeleit-es commented 9 months ago

Does this conversion really apply to the data which is then available in the CaaS?

Yes

samo4b commented 9 months ago

@jodeleit-es Ok thanks I'll let the rule get set up and if that works for us I can close the ticket.

samo4b commented 9 months ago

@jodeleit-es Thank you for the hint it worked out great! It solved every issue we had with & and the FSXARichText.

Just as an example: image

Result in the Frontend: image