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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

What APIs should be used to create a XML file in AEM?

Avatar

Level 2

We create a AEM pages using PageManager class. Like this I want to create a XML file dynamically and store in DAM location. Can anyone tell me what API should be used to create a XML files in AEM?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You need to use Asset API

 

 com.day.cq.dam.api.AssetManager assetMgr = resourceResolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
assetMgr.createAsset(<attachmentPath>, <input stream>,<contentType>, true);
 
 for XML files, contentype = 'application/xml'

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/upload-assets-to-aem-using...

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

You need to use Asset API

 

 com.day.cq.dam.api.AssetManager assetMgr = resourceResolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
assetMgr.createAsset(<attachmentPath>, <input stream>,<contentType>, true);
 
 for XML files, contentype = 'application/xml'

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/upload-assets-to-aem-using...