File file = null;
file = new File(strSbXmlFile);
Document doc = null;
Element root = null;
Element rootValue = null;
SAXBuilder sb = null;
Namespace s = null;
List group;
sb = new org.jdom.input.SAXBuilder();
try {
doc = sb.build(file);
root = doc.getRootElement();
s = root.getNamespace();
Element ss= root.getChild("jiedian", s).getChild("head", s).getChild("publicHead", s).getChild("value", s);
ss.getChild("Q", s).setText("2013-08-01");
ss.getChild("Z", s).setText("2013-09-30");
org.jdom.output.XMLOutputter out = new org.jdom.output.XMLOutputter();
Format format = Format.getPrettyFormat();
format.setEncoding("GBK");
out.setFormat(format);
out.output(doc, new java.io.FileOutputStream(strSbXmlFile));
} catch (JDOMException e) {
} catch (IOException e) {
}
return ret;
}
我这样对一个xml文件某一个节点进行修改之后,在本地测试没有任何问题,可是放到服务器上,再次读取文件的时候,读取的内容都是空的,没有任何的内容。我想问一下高手,有知道原因的没有,急急急!谢谢
file = new File(strSbXmlFile);
Document doc = null;
Element root = null;
Element rootValue = null;
SAXBuilder sb = null;
Namespace s = null;
List group;
sb = new org.jdom.input.SAXBuilder();
try {
doc = sb.build(file);
root = doc.getRootElement();
s = root.getNamespace();
Element ss= root.getChild("jiedian", s).getChild("head", s).getChild("publicHead", s).getChild("value", s);
ss.getChild("Q", s).setText("2013-08-01");
ss.getChild("Z", s).setText("2013-09-30");
org.jdom.output.XMLOutputter out = new org.jdom.output.XMLOutputter();
Format format = Format.getPrettyFormat();
format.setEncoding("GBK");
out.setFormat(format);
out.output(doc, new java.io.FileOutputStream(strSbXmlFile));
} catch (JDOMException e) {
} catch (IOException e) {
}
return ret;
}
我这样对一个xml文件某一个节点进行修改之后,在本地测试没有任何问题,可是放到服务器上,再次读取文件的时候,读取的内容都是空的,没有任何的内容。我想问一下高手,有知道原因的没有,急急急!谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货