java parse xml string

Solutions on MaxInterview for java parse xml string by the best coders in the world

showing results for - "java parse xml string"
Lennart
01 Aug 2016
1public static Document loadXMLFromString(String xml) throws Exception
2{
3    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
4    DocumentBuilder builder = factory.newDocumentBuilder();
5    InputSource is = new InputSource(new StringReader(xml));
6    return builder.parse(is);
7}