dom4j的应用(1)

 private String parseXml(String fileName)
    {
        String result = null;
        SAXReader sax = new SAXReader();

        ServletContextResource ss = new ServletContextResource(FlexContext
                .getServletContext(), fileName);
        try
        {
            Document dc = sax.read(ss.getFile());
            Element root = dc.getRootElement();
            result = root.asXML();

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return result;
    }

    public List<?> getAllWorkFlowList()
    {
        String sql = "select * from EOA_WF_MOD_INFO";
        List list = null;
        try
        {
            list = jdbcTemplate.queryForList(sql);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return list;
    }

    public String getFlowConfigXML(String modName)
    {
        String fileName = "templates/" + modName + ".jpdl.xml";
        return parseXml(fileName);
    }

你可能感兴趣的:(dom4j的应用(1))