finos / symphony-bdk-java

The Symphony BDK (Bot Developer Kit) for Java helps you to create production-grade Chat Bots and Extension Applications on top of the Symphony REST APIs.
https://symphony-bdk-java.finos.org
Apache License 2.0
23 stars 68 forks source link

How can I get the text with proper delimiter of multi line text? #645

Closed mccheung0610 closed 2 years ago

mccheung0610 commented 2 years ago

Support Question

How can I get the text with proper delimiter of multi line text? eg. How are you

I tried to use PresentationMLParser.getTextContent but it will return "Howareyou"

symphony-mariacristina commented 2 years ago

Hello @mccheung0610,

What the PresentationMLParser.getTextContent function does is to remove all html tags that are found in the original presentationML, returning only free text. The example you gave is translated in presentationML as follows:

<p>how</p><p>are</p><p>you</p><p></p>

Being each linebreak an html tag then the returned value from the function is going to automatically remove them.

If you actually need to get all the linebreaks as well I would suggest maybe to parse the presentationML directly instead of extracting it with the PresentationMLParser.