This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML keyword search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply locked New topic
Author

XML keyword search

krishna moorthyv
Greenhorn

Joined: Dec 13, 2012
Posts: 7
For an XML keyword search project, users may search any value in the XML code

<?xml version="1.0" encoding="UTF-8"?>
<company>
<staff id="1001">
<firstname>sachin</firstname>
<lastname>tendulkar</lastname>
<nickname>TON</nickname>
<salary>100000</salary>
</staff>
<staff id="2001">
<firstname>MS</firstname>
<lastname>Dhoni</lastname>
<nickname>MSD</nickname>
<salary>200000</salary>
</staff>
<staff id="3001">
<firstname>yuraj</firstname>
<lastname>singh</lastname>
<nickname>yuvi</nickname>
<salary>200000</salary>
</staff>
</company>

If the user searches for 20000, the result will available in ID 1001 and 2001 so the output should be like:

ms
dhoni
msd
200000

yuraj
singh
yuvi
20000
I need code to do this in Java.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Where is your code? What problems are you having with it? Please be sure to read NotACodeMill.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

I've closed this due to a new topic being posted.
 
 
subject: XML keyword search
 
Similar Threads
Dom to JAXB
code to read the xml and also overide the value of certain attributes in xml at runtime itself
XML file parsing in Java using SAX
How to get a xml id value in java
The pain of a beginner developer - deciphering cryptic documentation and such