读取xml文件,并将其转化成String

读取

SAXReader sr = new SAXReader();
    Document document = sr.read("WebRoot/WtzNdxx.xml");//读取xml文件
        Element root = document.getRootElement();
    String ss= document.asXML();//将document转化成String
    StringBuffer sb = new StringBuffer();
        sb.append(ss);

解析

Document doc = ServiceUtil.getDocument(sb);
writerDocumentToNewFile(doc); 
Map jcfwyyColumMap = ServiceUtil.getColumMap(T_xmkgl_ggb.class);
List eleList = doc.selectNodes("zdxm/ggb");//公共表字段解析

你可能感兴趣的:(读取xml文件,并将其转化成String)