Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumeration or Iterator?

Status
Not open for further replies.

aswolff

Programmer
Jul 31, 2006
100
US
Hi..I need to write a java program that will "iterate" over a set of files (*.xml) in a given directory. For each file I need to open it up and readin the xml contents...do some processing on it and close then rename or delete the file.

I am wondering if I should use an Enumeration or Iterator or is that overkill and there is a much simpler way?

Thank You.

Alex-
 
I myself will not spend so much on considering this. You may read all the filenames into String array. Then you can use sax or dom technique to read all the values from xml.
As the string array has stored the filename, you can rename the
processed xml with that string array.
How is your experience in processing xml with Java? If you are new to processing xml with Java, programming with sax or dom will take you some time.
 
Actually File class will return a File array with the method listFiles.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top