Skip to main content
Apr 20, 2016 4:54 PM UTC
Solved

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

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Apr 20, 2016 8:32 PM UTC

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. 

2 replies

smacdonald2008
smacdonald2008Accepted solution
Level 10
Apr 20, 2016 8:32 PM UTC

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. 

Translate
kharris3Author
Apr 21, 2016 12:26 PM UTC

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

Translate