开发者

How to search in JTree/xml

I am creating a JTree from an xml file.

Q: I hav开发者_运维知识库e 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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜