12-08-2009 01:04 AM
i need to perform a search operation on a xml file. am trying to achieve this in the following manner
1) parsing the xml file.
2) saving all the data to a vector.
3) searching thru this vector. using any logic.
i think there is a better alternative for this, rather than parsing and then performing searching.
hope some1 can help!!!!
12-08-2009 02:15 AM
I am not sure if you can actually search through an xml file without parsing. The method that you have mentioned appears to be good enough to do your job.. If you do find something better , please do mention.
12-08-2009 03:42 AM
Thanks for your reply!!!!
without parsing we cannot do the searching... but searching them in vector element is taking long time. it is much similar to the linear search... i just want to improve the search time by writting an efficient code.
can any1 help me in choosing the right data structure to accomplish this.
12-08-2009 03:48 AM
Use a more efficient data structure. Depending on your needs there are many available as j2me (open source) i think.
12-08-2009 03:52 AM
Did u try NodeList??
12-08-2009 04:41 AM
google: java data structures
list, linked list, tree, binary tree, hashtable, hashmap,
or even better: look for your local university and listen to some lectures...
if you tell us what you want to sort and how, maybe we could suggest an algorithm or data structure, guess there is the one or other here that actually knows what he is doing.
12-08-2009 05:23 AM
i have a data in string format coming from the xml files. am parsing that and am trying to store that data into vectors.
am searching in this vector. so it much similar to the linear search. am performing the linear search logic here.
how to improve search time thats my problem.
plz refer my OP.
12-08-2009 05:28 AM
and what are you searching for?
12-08-2009 05:39 AM
the xml file contains names. user searches for the name.
my requirement is similar to the keywordfilterdemo shipped with jde. i followed it, for small files it is working fine, i just want to improve the performance for a data that contains more than 5000 entries.
that to in that file the data is similar to that of csv files. it is all ',' separated. here i need to parse the xml file. am using sax parser for this.