Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

help regarding file operation

  Asked By: Madeline    Date: Jan 22    Category: Java    Views: 758
  

I need to search for a node in a very big xml file (say 100 MB) and delete
it.
can any body give me some idea to implement this....

I am thinking of implementing it using java streams.

Is there any way to search for a key word in such a big file ?
How can i commit this changes to the file after deleting a xml node?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Louis Mason     Answered On: Jan 22

The only way you could search  the XML file  would be to index it first
and then searching it. You could do this using something like Lucene.
It may be just as fast however to just read through the file from the
beginning to locate the node  in question. 100 MB is really not that big
so it shouldn't take to long to read through it. Now, as for writing it
back out you'll probably want to write to another file, skip the
matching node and write the remainder of the file, then replace the
original file with the new file.

 
Didn't find what you were looking for? Find more on help regarding file operation Or get search suggestion and latest updates.




Tagged: