views:

28

answers:

2

I am creating a JTree from an xml file.

Q: I have to implement a search functionality . I have done it using JTree and I have observed that its too slow and my tree is quite heavy.

Q. Please suggest if I can implement using xml file

A: 

I always suggest UI programmers to avoid creating huge user interface widgets such as trees and lists.

The best solution is to parse your XML file, keep it in memory if it's size allows it, perform the search in the memory and then display ONLY the result of the search !!!

If the file can't fit into memory, then you should have a look on XML Sax parser and look forward to allow your end users to navigate in the data represented by your XML file.

Manu

Manuel Selva
A: 

I hope I understand correctly :)

If You need to query collections of XML data then use XQuery / XPath (wich especially designed for XML processing).

Best Regards, Gedevan

gedevan