I have an XML file which might be empty or already partially populated and I'm given an XPath in which I should insert some more xml nodes. Which is the cleaner way to create all the child nodes needed?
In my mind, I'd like to find something like the mkdirs() method of the java.io.File class.
Example,
given the XPath /root/child/grandson the expected output would be (based on an empty input file):
<root>
<child>
<grandson></grandson>
</child>
</root>
Edit: I've for now managed to solve my simple use case by splitting the XPath and by nesting the nodes, any other cleaner solution would be appreciated.