@Test public void testStringToDoc() throws IOException { XMLUtils.stringToDoc(XML_STRING); XMLUtils.stringToDoc(XML_STRING_HUGE); }
public static Document stringToDoc(String str) throws IOException { if (StringUtils.isNotEmpty(str)) { try { Reader reader = new StringReader(str); DocumentBuilder db = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = db.parse(new InputSource(reader)); reader.close(); return doc; } catch (Exception ex) { log.debug("String: {}", str); throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage())); } } else { throw new IOException("Error - could not convert empty string to doc"); } }
XMLUtils { public static Document stringToDoc(String str) throws IOException { if (StringUtils.isNotEmpty(str)) { try { Reader reader = new StringReader(str); DocumentBuilder db = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = db.parse(new InputSource(reader)); reader.close(); return doc; } catch (Exception ex) { log.debug("String: {}", str); throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage())); } } else { throw new IOException("Error - could not convert empty string to doc"); } } }
XMLUtils { public static Document stringToDoc(String str) throws IOException { if (StringUtils.isNotEmpty(str)) { try { Reader reader = new StringReader(str); DocumentBuilder db = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = db.parse(new InputSource(reader)); reader.close(); return doc; } catch (Exception ex) { log.debug("String: {}", str); throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage())); } } else { throw new IOException("Error - could not convert empty string to doc"); } }  }
XMLUtils { public static Document stringToDoc(String str) throws IOException { if (StringUtils.isNotEmpty(str)) { try { Reader reader = new StringReader(str); DocumentBuilder db = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = db.parse(new InputSource(reader)); reader.close(); return doc; } catch (Exception ex) { log.debug("String: {}", str); throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage())); } } else { throw new IOException("Error - could not convert empty string to doc"); } }  static Document stringToDoc(String str); static String docToString(Document dom); static String docToString1(Document dom); static String docToString2(Document domDoc); }
XMLUtils { public static Document stringToDoc(String str) throws IOException { if (StringUtils.isNotEmpty(str)) { try { Reader reader = new StringReader(str); DocumentBuilder db = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = db.parse(new InputSource(reader)); reader.close(); return doc; } catch (Exception ex) { log.debug("String: {}", str); throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage())); } } else { throw new IOException("Error - could not convert empty string to doc"); } }  static Document stringToDoc(String str); static String docToString(Document dom); static String docToString1(Document dom); static String docToString2(Document domDoc);  }