How to read XML file from DAM and place it in JCR? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

arunpatidar
New Participant
Jul 12, 2018 7:16 AM UTC

Hi,

Please check below article

Creating a Custom Watched Folder Service for Adobe Experience Manager 6.3

Thanks

Arun

Translate
Arun Patidar
New Participant
Jul 12, 2018 7:26 AM UTC

Arun,

Thanks,But this doc tells how to read xml file from our local/desktop.But my question is how from aem dam? Any api and how to use it.

Translate
arunpatidar
New Participant
Jul 12, 2018 8:32 AM UTC

Hi,

You can use Node API to read XML from DAM.

Example:

Node node = req.getResourceResolver().getResource(qs.toString()+"/jcr:content").adaptTo(Node.class);

InputStream in = node.getProperty("jcr:data").getBinary().getStream();

  BufferedReader reader = new BufferedReader(new InputStreamReader(in));

          StringBuilder out = new StringBuilder();

          String line;

          while ((line = reader.readLine()) != null) {

              out.append(line);

          }

          reader.close();

  log.debug("File DATA ==> " + out.toString());

aem63app-repo/ReadFileServlet.java at master · arunpatidar02/aem63app-repo · GitHub

Thanks

Arun

Translate
Arun Patidar