/** * Usage: You can get a instance of Document from a string of xml. * This class supply some method to read a document. * */ public class XMLParser {
/** * Get a instance of Document from a string of xml. * * @param xmlStr * @return Document */ public static Document parse(String xmlStr) { if (xmlStr == null) { return null; } StringReader reader = new StringReader(xmlStr); InputSource source = new InputSource(reader); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null;