### Question:
SqlXMLConfigParse { public static SqlToyConfig parseSagment(Object sqlSegment, String encoding, String dialect) throws Exception { Element elt = null; if (sqlSegment instanceof String) { Document doc = domFactory.newDocumentBuilder().parse( new ByteArrayInputStream(((String) sqlSegment).getBytes(encoding == null ? "UTF-8" : encoding))); elt = doc.getDocumentElement(); } else if (sqlSegment instanceof Element) { elt = (Element) sqlSegment; } if (elt == null) { logger.error("sqlSegment type must is String or org.w3c.dom.Element!"); throw new IllegalArgumentException("sqlSegment type must is String or org.w3c.dom.Element!"); } return parseSingleSql(elt, dialect); }  static void parseXML(List xmlFiles, ConcurrentHashMap<String, Long> filesLastModifyMap,
			ConcurrentHashMap<String, SqlToyConfig> cache, String encoding, String dialect); static void parseSingleFile(Object xmlFile, ConcurrentHashMap<String, Long> filesLastModifyMap,
			ConcurrentHashMap<String, SqlToyConfig> cache, String encoding, String dialect, boolean isReload); static SqlToyConfig parseSagment(Object sqlSegment, String encoding, String dialect); static SqlToyConfig parseSingleSql(Element sqlElt, String dialect); static void parseSecureMask(SqlToyConfig sqlToyConfig, NodeList maskElts); static void parseTranslate(SqlToyConfig sqlToyConfig, NodeList translates); static HashMap<String, String> filters; }### Answer:
@Test public void testParseSegmentXML() { String sql = FileUtil.readFileAsStr("classpath:scripts/report.xml", "UTF-8"); try { SqlToyConfig result = SqlXMLConfigParse.parseSagment(sql, "utf-8", "mysql"); System.err.println(JSON.toJSONString(result)); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testParseSqlXML() { String sql = FileUtil.readFileAsStr("classpath:scripts/sql.xml", "UTF-8"); try { SqlToyConfig result = SqlXMLConfigParse.parseSagment(sql, "utf-8", "mysql"); System.err.println(JSON.toJSONString(result)); } catch (Exception e) { e.printStackTrace(); } }