日期:2014-05-20 浏览次数:20751 次
public static void main(String[] args)
{
//修改条件和修改的值
final String nameStr = "name2";
final String valueStr = "value222";
File xmlFile = new File("D:\\java\\test_java\\someXML.xml");
SAXReader reader = new SAXReader();
XMLWriter output = null;
InputStream isr = null;
try
{
//定义文件输入流
isr = new FileInputStream(xmlFile);
//以UTF-8的编码方式读取配置文件
Document document = reader.read(new InputStreamReader(isr, "UTF-8"));
//Document document = reader.read(xmlFile);
Element root = document.getRootElement();