Hi,
I have a requirement wherein i have to read xml file from dam and place that data under nodes in JCR.
Kindly help on this!
Views
Replies
Total Likes
Hi,
Please check below article
Creating a Custom Watched Folder Service for Adobe Experience Manager 6.3
Thanks
Arun
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Reading an XML will not be any different whether it came from the DAM or a folder on the desktop.
To get the file from the JCR - you can use the JCR API to retrieve the file (Arun Patidar showed a code snippet).
Then use Java logic to read the XML file.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies