This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes want to search XML files for strings Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "want to search XML files for strings" Watch "want to search XML files for strings" New topic
Author

want to search XML files for strings

majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 160
Hi,
I have lot of xml files , they are differents, I have like more than 200 strings in a text file each string in a line, I want to search for these strings patterns in these XML files, please do you have an idea or do you know a code that does that ?
thanks, your help is appreciated.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35247
    
    7
The simplest approach would be to treat the files as plain text, and read them line by line and look for the search string. This could be made a lot more efficient by using a search library like Lucene.

If you need precise control over which parts of an XML file are searched, have a look at XQuery, which is a standard for searching XML. One Java implementation is Nux, which sits on top of the excellent XOM library.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to search XML files for strings
 
Similar Threads
XSL 'like' operator
How to compare two XML files?
How can I determine if a string array contains a particular string?
String parsing help.
How to search String for Map Key