欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

XML: 一般文件写和加载库(Java),xmljava,http://www.c

来源: javaer 分享于  点击 21094 次 点评:139

XML: 一般文件写和加载库(Java),xmljava,http://www.c


http://www.codeproject.com/KB/library/GenericXMLFile.aspx

[Java]代码

//// This is a simple example how the library can be used//GenericXml gx = new GenericXml();IGeneric xmldata = gx.createNewDatamodel();IGeneric cat = gx.createCategory(xmldata, "Manager", "John Blake", Type.TEXT);IGeneric entry = gx.createEntry(cat, "Employee", "Susan Meyer", Type.TEXT, null);IGeneric data = gx.createData(entry, "Salary", "4.653,00", Type.NUMBER);gx.createTag(data, new String[] {"confidential"});System.out.println(gx.toString()); // debug outputgx.saveData(new File ("c:\\temp\\generic.test.xml")); // save to file

[XML]代码

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xmldatafile name="xmldatadefault">        <category key="Manager" value="John Blake" type="text">                <entry key="Employee" value="Susan Meyer" type="text">                        <data value="4.653,00" key="Salary" type="number"/>                                <tag value="confidential"/>                        </data>                </entry>        </category></xmldatafile>
相关栏目:

用户点评