Expand my Community achievements bar.

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...

 



Arun Patidar

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...

 



Arun Patidar