快速业务通道

用Java从XML文件中获取业务图表 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-23
dItem(elemItem, "url"); strDataURL = strDataURL.replace(''_'',''&''); LoadDataDoc(strDataURL); strChartConfigURL = GetChildItem(elemItem, "config"); LoadConfigDoc(strChartConfigURL); strDummy = GetChildItem(elemItem, "series"); LoadSeries(strDummy); strDummy = GetChildItem(elemItem, "categories"); LoadCategories(strDummy); nXSize = new Integer(strX).intValue(); if (nXSize==0) { strDummy = GetChildItem(elemItem, "XSize"); nXSize = new Integer(strDummy).intValue(); } nYSize = new Integer(strY).intValue(); if (nYSize==0) { strDummy = GetChildItem(elemItem, "YSize"); nYSize = new Integer(strDummy).intValue(); } DoChart(); response.setContentType("image/jpeg"); OutputStream out = response.getOutputStream(); ChartUtilities.writeChartAsJPEG(out, chart, nXSize, nYSize); out.close(); } catch(Exception e) { e.printStackTrace(); } } private String GetChildItem(Element elemItem, String strElemName) { NodeList nL; String strReturn; nL = elemItem.getElementsByTagName(strElemName); if(nL.getLength()>0) { Node ndeItem = nL.item(0); strReturn = ndeItem. getFirstChild().getNodeValue(); } else { strReturn = "null"; } return strReturn ; } private void LoadDataDoc(String strDocURL) { try{ URLConnection urlDataConn = new URL(strDataURL).openConnection(); urlDataConn.connect(); InputStream inData = urlDataConn.getInputStream(); xmlData = dfactory.newDocumentBuilder().parse(inData); } catch (Exception e){ } } private void LoadConfigDoc(String strConfigURL) { try{ URLConnection urlDataConn = new URL(strConfigURL).openConnection(); urlDataConn.connect(); InputStream inData = urlDataConn.getInputStream(); xmlConfig = dfactory.newDocumentBuilder().parse(inData); } catch (Exception e){ } } private void LoadSeries(String strSeries) { int nCurrentLoc = 0; int nLoc = 1; String chToFind = ","; String strCurrent; strDataXPaths.clear(); nDataXPathCount = 0; while(nLoc>0) { nLoc = strSeries.indexOf(chToFind,nCurrentLoc); if(nLoc>0) { strCurrent = strSeries.substring(nCurrentLoc,nLoc); strSeries = strSeries.substring(nLoc+1,strSeries.length()); } else { strCurrent = strSeries; } strDataXPaths.add(strCurrent); nDataXPathCount++; } } private void LoadCategories(String strCategories) { int nCurrentLoc = 0; int nLoc = 1; nCategoryXPathCount = 0; String chToFind = ","; String strCurrent; strCategoryXPaths.clear(); while(nLoc>0) { nLoc = strCategories.indexOf(chToFind,nCurrentLoc); if(nLoc>0) { strCurrent = strCategories.substring(nCurrentLoc,nLoc); strCategories = strCategories.substring(nLoc+1,strCategories.length()); } else { strCurrent = strCategories; } strCategoryXPaths.add(strCurrent); nCategoryXPathCount++; } } private void LoadSeriesTitles(String strSeriesTitles) { int nCurrentLoc = 0; int nLoc = 1; String chToFind = ","; String strCurrent; strSTitles.clear(); while(nLoc>0) { nLoc = strSeriesTitles.indexOf(chToFind,nCurrentLoc); if(nLoc>0) { strCu

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号