Possible to execute Sightly Parsing on a String returned by a service? | Community
Skip to main content
April 20, 2016
Solved

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

  • April 20, 2016
  • 2 replies
  • 943 views

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.
Best answer by smacdonald2008

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
April 20, 2016

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. 

kharris3Author
April 21, 2016

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