我有xmloutputter
.AT则创建它创建了我的头,但后来我追加它的信息在第一时间创建一个XML文件,我会不header.how能我省略了?xml文件中如何omitt头部附加信息时
编辑
Element performances = new Element("performances");
Document doc = new Document(performances);
performances.setAttribute(new Attribute("date", dateFormat.format(cal.getTime())));
//Uptime
Element uptime = new Element("uptime");
uptime.addContent(new Element("days").setText(new Long(duptime).toString()));
uptime.addContent(new Element("hours").setText(new Long(huptime).toString()));
uptime.addContent(new Element("minutes").setText(new Long(muptime).toString()));
uptime.addContent(new Element("seconds").setText(new Long(suptime).toString()));
doc.getRootElement().addContent(uptime);
//TotalHitsCount
doc.getRootElement().addContent(new Element("totalhitcount").setText(new Long(stats.gettotal_hit_count()).toString()));
//EmittedBytes
doc.getRootElement().addContent(new Element("emittedbytes").setText(new Long(stats.getemitted_bytes()).toString()));
//Avghitsec
doc.getRootElement().addContent(new Element("avghitsec").setText(new Float(stats.getavg_hit_sec()).toString()));
//Avgbyteshit
doc.getRootElement().addContent(new Element("avgbyteshit").setText(new Long(stats.getavgbytes_hit()).toString()));
//Avgbps
doc.getRootElement().addContent(new Element("avgbps").setText(new Long(stats.getavgbps()).toString()));
//Total threads
doc.getRootElement().addContent(new Element("totalthreads").setText(new Long(stats.gettotal_threads()).toString()));
//Idle threads
doc.getRootElement().addContent(new Element("idlethreads").setText(new Long(stats.getidle_threads()).toString()));
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat());
xmlOutput.output(doc, new FileWriter((String)path+"performances.xml",true));
什么是xmloutputter?它似乎不是JDK中的一个类。 – 2012-07-14 18:58:39
它属于jdom包 – Mazzy 2012-07-14 19:25:54