用的是jdom包URL url = RederXml.class.getClassLoader().getResource(""); String path = url.toString() + "/config.xml";\\工程種xml的路徑 HashMap<String, String> map = new HashMap<String, String>(); SAXBuilder sax = new SAXBuilder(); Document doc = null; try { doc = sax.build(path); } catch (JDOMException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Element root = doc.getRootElement();
用的是jdom包URL url = RederXml.class.getClassLoader().getResource(""); String path = url.toString() + "/config.xml";\\工程種xml的路徑 HashMap<String, String> map = new HashMap<String, String>(); SAXBuilder sax = new SAXBuilder(); Document doc = null; try { doc = sax.build(path); } catch (JDOMException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Element root = doc.getRootElement();