Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Experience Fragment to HTML

Avatar

Avatar
Validate 1
Level 1
brijesht7477132
Level 1

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
brijesht7477132
Level 1

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
brijesht7477132
Level 1

08-09-2018

Hi Team,

We have an requirement to share the experience fragment as its HTML structure in JSON response in our Single page Application. So is there any way to convert experience fragment object/resource to its HTML structure in Back-end Java code.

Thanks in Advance for the responses.

With regards

Brijesh

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,260 likes

Total Posts

3,140 posts

Correct Reply

886 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,260 likes

Total Posts

3,140 posts

Correct Reply

886 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

08-09-2018

Hi,

Since XF behave similar to pages in AEM and content created and rendered with the help of different components. As far as I know the only way to read HTML content from XF is possible by reading input stream

Reading Directly from a URL (The Java™ Tutorials > Custom Networking > Working with URLs)

If above solution is suitable for your requirement you can create a default sling servlet with some add selector e.g. xftohtml

and convert page into desire html. You may read body section and remove unwanted scripts and placeholder divs.

Avatar

Avatar
Level 1
sandeep_kumara1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
sandeep_kumara1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
sandeep_kumara1
Level 1

27-11-2018

Additionally, if you want to expose html content with scripting and styling, you can share the needed JS, CSS file absolute URL along with needed html stream