Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Possible to execute Sightly Parsing on a String returned by a service?

Avatar

Level 1

I'm looking to see if it is possible to get a string of HTML from a service and execute the sightly parser on that string. We have a service layer that returns HTML and I'd like to be able to have sightly markup within that HTML for processing. For example using i18n ${'key', @i18n}.

I've tried wrapping the HTML returned in a sightly template and then calling it within my sightly component but unfortunately it did not work.

1 Accepted Solution

Avatar

Correct answer by
Level 10

The best practice to handle DOM parsing when writing a Sightly component is to have the Java logic (part of the Sightly component) handle the parsing.

You can use a Java API to handle the logic - such as JSOUP API. Sighly is for displaying data - not for manipulating data like DOM parsing. It way better to handle that on the Java side. 

See this community article: 

https://helpx.adobe.com/experience-manager/using/domparser.html

Hope this helps you. 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

The best practice to handle DOM parsing when writing a Sightly component is to have the Java logic (part of the Sightly component) handle the parsing.

You can use a Java API to handle the logic - such as JSOUP API. Sighly is for displaying data - not for manipulating data like DOM parsing. It way better to handle that on the Java side. 

See this community article: 

https://helpx.adobe.com/experience-manager/using/domparser.html

Hope this helps you. 

Avatar

Level 1

Thanks, that's pretty much what I figured as well, was just hoping to leverage what was already there. Appreciate the input.