其实xml文件就是普通的文本文件,但写普通的文本文件写吧.我这边就是这样做的.
解决方案 »
- java连接mysql问题
- 随机数组问题?
- tomcat数据库连接池错误! 分不多,非常着急!
- struts+jdbc中文乱码问题!
- 用java类打开文件问题!!!!项目着急!!!!!!!!!!!!
- 有关HttpServletRequest接口的问题
- 在windows server 2003 sp2中,如何设置startup.bat为开机进程?看不到黑色dos窗体的那种。
- spring3.1 使用 jpa2 出错
- 所有的浏览器都支持Java吗,如果不是,那有哪些是不支持Java?我在网页中用到了applet,怎样来判断已经安装好了代码呢?
- XML问题
- 如何在JSP页面上显示XML文件
- 关于WEB SERVICES 连接超时的问题
String nodeText) throws XMLParserException {
try {
if (doc == null ||
filePath == null || filePath.equals("") ||
xPath == null || xPath.equals("") ||
nodeName == null || nodeName.equals("")) {
return;
}
Element root = doc.getRootElement();
List listNode = XPath.selectNodes(root, xPath);
if (listNode == null || listNode.size() <= 0) {
return;
Element childNode = new Element(nodeName);
if (nodeText != null && !nodeText.trim().equals("")) {
childNode.setText(nodeText);
}
for (Object objNode : listNode) {
Element parentNode = (Element) objNode;
parentNode.addContent(childNode);
}
save(doc, filePath);
} catch (Exception e) {
}
}private static void save(Document doc, String filePath) throws XMLParserException {
if(doc == null ||
filePath == null || filePath.equals("")) {
return;
}
Format format = Format.getPrettyFormat();
format.setEncoding(ENCODING);
format.setIndent(INDENT);
XMLOutputter outputter = new XMLOutputter(format);
try {
outputter.output(doc, new FileOutputStream(filePath));
} catch (Exception e) {
}
}
http://www.cnblogs.com/huazi4995/articles/587059.html