SAXReader reader = new SAXReader();
Document doc = reader.read(ClassLoader.getSystemResource("config/NewFile.xml"));
OutputFormat oformat = OutputFormat.createCompactFormat();//紧凑的格式
// OutputFormat.createPrettyPrint()//换行
oformat.setEncoding("utf-8");
StringWriter out = new StringWriter();
XMLWriter writer = new XMLWriter(out,oformat);
writer.write(doc);
System.out.println(out.toString());