首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

生成Data.xml 资料

2012-07-02 
生成Data.xml 文件private void BuildXMLDoc(MapString, ListWebGameIncome map) throws IOException,

生成Data.xml 文件

private void BuildXMLDoc(Map<String, List<WebGameIncome>> map) throws IOException, JDOMException {                    // 创建根节点 chart;             Element root = new Element("chart");                      root.setAttribute("animation", "1");         root.setAttribute("showvalues", "0");         root.setAttribute("caption", "");         root.setAttribute("subcaption", "");         root.setAttribute("numberprefix", "");         root.setAttribute("chartrightmargin", "15");         root.setAttribute("xaxisname", "");         root.setAttribute("yaxisname", "");         root.setAttribute("pyaxisname", "");         root.setAttribute("canvasborderalpha", "0");         root.setAttribute("bgcolor", "FFFFFF");         root.setAttribute("bgratio", "0");         root.setAttribute("bgalpha", "50");         root.setAttribute("showalternatehgridcolor", "0");         root.setAttribute("numdivlines", "0");         root.setAttribute("showyaxisvalues", "0");         root.setAttribute("showlegend", "0");         root.setAttribute("chartleftmargin", "35");         root.setAttribute("charttopmargin", "25");         root.setAttribute("chartbottommargin", "35");         root.setAttribute("drawanchors", "0");         root.setAttribute("bordercolor", "970000");         root.setAttribute("borderalpha", "31");         root.setAttribute("stack100percent", "0");         root.setAttribute("linethickness", "3");         root.setAttribute("basefontsize", "12");         root.setAttribute("themename", "Custom");                    // 根节点添加到文档中;             Document Doc = new Document(root);                    Element category = new Element("categories");         Element dateSet1 = new Element("dataset");         dateSet1.setAttribute("seriesName", "kxd");         dateSet1.setAttribute("color_cc", "CE0000");         dateSet1.setAttribute("color", "CE0000");         Element dateSet2 = new Element("dataset");         dateSet2.setAttribute("seriesName", "income");         dateSet2.setAttribute("color_cc", "7F7F7F");         dateSet2.setAttribute("color", "7F7F7F");                  for (Entry<String, List<WebGameIncome>> entry : map.entrySet()) {             List<WebGameIncome> value = entry.getValue();             if ((value.get(0) != null) && (value.get(0).getKxd() != 0)) {                 category.addContent(new Element("category").setAttribute("label", entry.getKey()));                 dateSet1.addContent(new Element("set").setAttribute("value", String.valueOf(value.get(0).getKxd())));                 dateSet2.addContent(new Element("set").setAttribute("value", String.valueOf(value.get(0).getIncome())));             }         }                  root.addContent(category);         root.addContent(dateSet1);         root.addContent(dateSet2);                        XMLOutputter XMLOut = new XMLOutputter();                      // 输出 Data.xml 文件;            XMLOut.output(Doc, new FileOutputStream(FileUtil.getXMLDataBasePath() + "/xmldata/Data.xml"));        }  

热点排行