我將屬性文件轉換爲如下所示的xml格式。如何將List添加到屬性文件中?
public class XmlPropertiesWriter {
public static void main(String args[]) throws FileNotFoundException, IOException {
//Reading properties files in Java example
Properties props = new Properties();
FileOutputStream fos = new FileOutputStream("C:\\Users\\Desktop\\myxml.xml");
props.setProperty("key1", "test");
props.setProperty("key2", "test1");
//writing properites into properties file from Java
props.storeToXML(fos, "Properties file in xml format generated from Java program");
fos.close();
}
}
這是工作fine.But我想一個ArrayList的加入到這個XML文件,我怎麼能做到這一點,任何一個可以幫助我。
什麼性質劃分?字符串?整型? –