Possible Duplicate:
Append node to an existing xml-Java可能重复:将节点追加到现有的xml-Java
i am having this code
我有这个代码
private void nextActionPerformed(java.awt.event.ActionEvent evt) {
File myfile;
FileInputStream myInputStream;
InputStreamReader myInputStreamReader;
BufferedReader myBufferedReader;
String databasedir =
"C:\\Users\\himu\\Documents\\NetBeansProjects\\database\\src\\database\\databases\\";
try{
myfile = new File(databasedir+dbname.getText());
myInputStream = new FileInputStream(myfile);
myInputStreamReader = new InputStreamReader(myInputStream);
myBufferedReader = new BufferedReader(myInputStreamReader);
String xmlval =
"<database>"
+ "<db id =" +dbname.getText() +">"
+ " <dbfileloc>" +myfile
+ "</dbfileloc> "
+ "</db>"
+ "</database>";
}
catch(Exception e)
{
}
}
**I want to append the string xmlval after the previous entry of xmlval in the already created dbrepoloc.xml file which is having this location C:\Users\himu\Documents\NetBeansProjects\database\src\database\dbrepoloc.xml i am not getting the exact code the place is mentioned above please help me
**我想在已创建的dbrepoloc.xml文件中附加xmlval之前的字符串xmlval,该文件具有此位置C:\ Users \ himu \ Documents \ NetBeansProjects \ database \ src \ database \ dbrepoloc.xml我是没有得到上面提到的确切代码,请帮助我
1 个解决方案
#1
0
You might want to consider one of the XML parsers to read and write a pre-existing XML document. Try Stax
您可能希望考虑使用其中一个XML解析器来读取和写入预先存在的XML文档。试试Stax
Also refer http://www.vogella.com/articles/JavaXML/article.html
另请参阅http://www.vogella.com/articles/JavaXML/article.html
#1
0
You might want to consider one of the XML parsers to read and write a pre-existing XML document. Try Stax
您可能希望考虑使用其中一个XML解析器来读取和写入预先存在的XML文档。试试Stax
Also refer http://www.vogella.com/articles/JavaXML/article.html
另请参阅http://www.vogella.com/articles/JavaXML/article.html