aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
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: 161
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: 39547
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to search XML files for strings
 
Similar Threads
How to search String for Map Key
XSL 'like' operator
String parsing help.
How to compare two XML files?
How can I determine if a string array contains a particular string?