Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

searching, sorting and xml file

 

Hi all,

 

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!!!!

Thanks and Regards,
PraveenGoparaju.
Developer
Posts: 207
Registered: ‎07-31-2009
My Device: Not Specified

Re: searching, sorting and xml file

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.

------------------------------------------------------------------------------------------------------------------------
Click the Kudos! badge on left side of the message , if you are happy with a solution given by a user. When you do so, you are saying thanks to its author.
Mark a reply as a solution , if you think your question has been answered.
To mark a message as a solution: Click "Accept as solution" icon on the reply.
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: searching, sorting and xml file

 

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.

Thanks and Regards,
PraveenGoparaju.
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: searching, sorting and xml file

Use a more efficient data structure. Depending on your needs there are many available as j2me (open source) i think.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 207
Registered: ‎07-31-2009
My Device: Not Specified

Re: searching, sorting and xml file

Did u try NodeList??

------------------------------------------------------------------------------------------------------------------------
Click the Kudos! badge on left side of the message , if you are happy with a solution given by a user. When you do so, you are saying thanks to its author.
Mark a reply as a solution , if you think your question has been answered.
To mark a message as a solution: Click "Accept as solution" icon on the reply.
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: searching, sorting and xml file

could you give some examples of such data structures??/

Thanks and Regards,
PraveenGoparaju.
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: searching, sorting and xml file

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.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: searching, sorting and xml file

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.

Thanks and Regards,
PraveenGoparaju.
Developer
Posts: 16,998
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: searching, sorting and xml file

and what are you searching for?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: searching, sorting and xml file

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.

Thanks and Regards,
PraveenGoparaju.