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

Storing DOMSource XML to Node Using JcrUtils.putFile method


Level 1

Hello Community,

I have a requirement of storing XML file created by POJO using Java DOM API(javax.xml.transform.dom.DOMSource) to a Node in JCR repository. I would like to use, JcrUtils.putFile(currentNode, "fileName.xml", "application/xml", fileInputStream);

But I am unable to convert the DOMSource or StreamResult to FileInputStream, to pass on to JcrUtils.putFile method. Could you please suggest any ideas?

Any other approaches to complete this problem are also welcome.

I thank you in advance.

-Mahabub Ali Mohammad.

1 Reply


Community Advisor

Dear Mohammad,

Not entirely sure why you want to use JCRUtils,

Transform your DOMSource into a String and store string via ModifiableValueMap and you are done;