Expand my Community achievements bar.

Storing DOMSource XML to Node Using JcrUtils.putFile method

Avatar

Level 2

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

Avatar

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;

Regards,

Peter