91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1KB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-10-07
  • 語言: Java
  • 標(biāo)簽: java??xml??

資源簡介

用java 通過xml模板生成 xml文件

資源截圖

代碼片段和文件信息

package?eg;

import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileNotFoundException;
import?java.io.FileReader;
import?java.io.IOException;
import?java.text.MessageFormat;
import?xmltool.template.GetxmlContont;

public?class?Generalxml?{

/**
?*?
?*?@Author:HaoMing(郝明)
?*?@Project_name:weinet
?*?@Full_path:eg.Generalxml.java
?*?@Date:@2014?2014-3-28?上午11:10:08
?*?@Return_type:String
?*?@Desc?:讀取指定的xml模板
?*/
public?static?String?readFileByer(String?filePath)?{
StringBuffer?sb?=?new?StringBuffer();
File?file?=?new?File(filePath);
FileReader?fr?=?null;
try?{
fr?=?new?FileReader(file);
}?catch?(FileNotFoundException?e)?{
e.printStackTrace();
}
BufferedReader?br?=?new?BufferedReader(fr);

String?strLine?=?““;
try?{
while?((strLine?=?br.readLine())?!=?null)?{
sb.append(strLine);
sb.append(“\n“);
}
}?catch?(IOException?e)?{
e.printStackTrace();
}?finally?{
try?{
fr.close();
br.close();
}?catch?(IOException?e)?{
e.printStackTrace();
}
}
return?sb.toString();
}

public?static?void?main(String[]?args)?{

final?String??head?=?“l?version=\“1.0\“?encoding=\“UTF-8\“?standalone=\“no\“?>\n“;
final?String?root_start?=?““;
final?String?root_end?=?“
“;

StringBuffer?sb?=?new?StringBuffer();
sb.append(head);
sb.append(root_start);

MessageFormat?mf?=?new?MessageFormat(GetxmlContont.readFileByer(“src/eg/template.xml“));
sb.append(mf.format(new?object[]?{?“l(fā)ist.jsp“?“get“?“l(fā)ist“?“request_param1|request_param2“}));
sb.append(mf.format(new?object[]?{?“content.jsp“?“post“?“content“?“titlepublisherpublished_calendar“}));

sb.append(root_end);

System.out.println(sb.toString());
// System.out.print(sb.toString().replaceAll(“\n“?““));
}
}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-03-28?11:26??eg\
?????文件????????1881??2014-03-28?11:30??eg\Generalxml.java
?????文件?????????119??2014-03-28?11:24??eg\template.xml

評(píng)論

共有 條評(píng)論