• Post Reply Bookmark Topic Watch Topic
  • New Topic

Substring and Searching  RSS feed

 
Franke Robinson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I have an xml file that I read in and would like to search string for the occurence of a word(s) passed to my servlet. How can I loop through this to output each string found?
 
eammon bannon
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A better way might be to parse the xml with SAX, using a Handler which recursively tests the element value for your search string. If you are using XML, may as well use it as XML rather than a character stream.
[ April 02, 2004: Message edited by: eammon bannon ]
 
Franke Robinson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eammon, thanks for your reply. For now I'm using an xml file, but it might be a .txt .html etc. So I'm just reading it in as a String.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!