• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parsing a text file, advice needed...

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I am parsing a text file. Its in a custom XML style of format. I want to extract certain values from the text file and store them in some classes I have made.

Just wondering if StringTokenizer is the best thing to use here? Any recommendations would be grately receieved too.

Many thanks
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String.split() which uses regular expressions is probably worth looking at.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If "custom XML style of format" means it's XML but you have a certain structure and set of element names and so on that you use, then a StringTokenizer would not be a good choice. An XML parser would be a better choice. If you haven't used one before, it will take a little bit of study to learn how, but in the long run it will result in a better solution.

(And if you have a format that looks like XML but isn't really, I would recommend you don't do it that way. Formats based on standards work better in the long run.)
 
reply
    Bookmark Topic Watch Topic
  • New Topic