/**
	 * XML 문자열을 DOM(Document) 객체로 변환
	 * @param xmlStr	XML문자열
	 * @return
	 * @throws Exception
	 */
	private static Document getStringToDOM(String xmlStr) throws Exception {
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		return builder.parse(new InputSource(new StringReader(xmlStr)));
	}
	
	/**
	 * DOM(Document) 객체를 XML 문자열로 변환
	 * @param xmlStr	XML문자열
	 * @return
	 * @throws Exception
	 */
	private static String getDOMToString(Document doc) throws Exception {
		TransformerFactory transfac = TransformerFactory.newInstance();
		Transformer trans = transfac.newTransformer();
		trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
		trans.setOutputProperty(OutputKeys.INDENT, "yes");
		
		StringWriter sw = new StringWriter();
		StreamResult result = new StreamResult(sw);
		DOMSource source = new DOMSource(doc);
		trans.transform(source, result);
		
		return sw.toString();
	}

+ Recent posts