public class Test { public static void main(String[] args) throws Exception { Properties properties = new Properties(); properties.load(new FileReader("users.properties")); System.out.println(properties);
public class Test { public static void main(String[] args) throws Exception { SAXReader saxReader = new SAXReader(); Document document = saxReader.read("aaa.xml"); Element element = document.getRootElement(); System.out.println(element); } }
public class Test { public static void main(String[] args) throws Exception { SAXReader saxReader = new SAXReader(); Document document = saxReader.read("aaa.xml"); Element root = document.getRootElement();
List<Element> elements = root.elements(); for (Element element:elements){ System.out.println(element.getName()); }//遍历输出 Element name = root.element("name");//默认获取name System.out.println(name); System.out.println(users.elementText(name));//获取文本内容 } }