Problem solve Get help with specific problems with your technologies, process and projects.

How to implement a search function on XML?

I'm currently working on a project using XML as a database...I'm able to retrieve the XML data and display on JSP...but I need a search engine. How can I do this? I've read a bit about GoXML, but I don't think I will use it because the size is too big. Is there any other way that I can implement search function on XML?

I take it you are storing the XML as a file or series of files rather than in an XML database per se? There are numerous ways to go to get search. Here are a few suggestions.

1) You could put the XML into an XML database which typically provides search capabilities. There are a variety of these ranging from free to very expensive. I recommend www.rpbourret.com for a survey of the terrritory.

2) If the XML is data-oriented XML it may make most sense to use a relational database to store the data and generate XML as needed on-the-fly.

3) If you only need to search aspects of the XML, it may make sense to create copies of these values into fields in a relational database for search purposes. This is particulary applicable for data that has identifiable "header" and "body" data.

4) you could roll-your-own indexing functions and save "index" files alongside your XML files for fast retrieval.

5) You could use an XML aware grepping utility such as sgrep http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.