I am wanting to convert a xml string to a xml file. I am getting a xml string as an out put and I have the following code so far:
public static void stringToDom(String xmlSource)
throws SAXException, ParserConfigurationException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(xmlSource)));
//return builder.parse(new InputSource(new StringReader(xmlSource)));
}
However Im not too sure where I go from here. I am not creating the file anywhere, so how do I incorporate that into it?
I am passing my xml string into xmlSource.