Java XML DOM from String stringToDom(String xmlSource)

Here you can find the source of stringToDom(String xmlSource)

Description

string To Dom

License

Apache License

Declaration

public static Document stringToDom(String xmlSource)
            throws SAXException, ParserConfigurationException, IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.*;

import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;

public class Main {
    public static Document stringToDom(String xmlSource)
            throws SAXException, ParserConfigurationException, IOException {

        DocumentBuilderFactory factory = DocumentBuilderFactory
                .newInstance();/* w ww.  j  a  v a2 s. c  o  m*/
        DocumentBuilder builder = factory.newDocumentBuilder();

        return builder.parse(new InputSource(new StringReader(xmlSource)));

    }
}

Related

  1. string2Dom(final String fileContent)
  2. string2Dom(String xml)
  3. stringToDOM(String html)
  4. stringToDOM(String xmlString)
  5. stringToDOM(String xmlString)