I have seen and read some guides about reading and writing file txt, but there are some small problems in my project, examples For my file is more than 200MB (is an XML file); Anyway, I want to read my file, a part of the code is:
node id = "1653281475" lat = "44.499773" lon = "11.350111" version = "1"
Timestamp = "2012-02-29 T20: 15: 15Z" changeet = "10831749" UID = "91650" user = "Alberto 58">
Tag k = "barrier" v = "gate" /> Tag k = "bicycle" v = "yes" /> gt; Tag k = "foot" v = "yes" /> tag k = "car" v = "yes" />
node / other node: node id = "16532843433" etc ..........
I want to Just look at the node id "1653281475" and change only the tag k = "foot" v = "yes" to k = "foot" v = "no", which is in this node.
How can I do this?
This is the second day that I am trying to read and write my XML document (now I am using a little 654byte xml) staff. XML, I have followed many guides but I do not understand how to do it, for example I follow this guide:
Then I Create a Java file that is located in a directory named Sach: Employee Java, MyHandler.java, XMLParserSAX.java (There are some errors in the witch, the code is similar to the page that has the link)
When I Use the command (I'm in Ubuntu 12.04) javac Sax / * No problem, however When I use java sax.XMLParserSAX employees.xml so many problems; First of all in the code, "import com.journaldev.xml.Employee;" -> The symbol can not be found. And the second error is similar but "MyHandler handler = new MyHandler ();" ... I think the problem is that XMLPArserSAX Don Class recognizes the employee ... what do I have to do? = (
Do not load the entire file into memory.Sack parser is designed for this type of use Use SAX Parser to read the file. When you read that each tag writes it to the output file - as long as you do not see the node id = "1653281475"
, when you see this node See, modify it and write it in the output file. Now continue to write nodes in the output file to the end. The package file will have modified XML at the end of this process.
Comments
Post a Comment