Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Search from a huge list !

Status
Not open for further replies.

fixthebug2003

Programmer
Oct 20, 2003
294
0
0
US
Hi,
I have a Well Formed XML Document that has around 1000+ nodes for names I am looking for.

In order to pull only those names that starts with, say "N" or any other letter, is there a fast way to perform the search, rather that going throuh the list of all the 1000+ names in the XML document?

THanks
Fixthebug2003

 
Not really. XPath (at least Microsoft's implementation) uses a linear search, and so it's very slow for large documents.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
mountainbiker -
A faster CPU will help, but a linear search is still a O(n) algorithm, so performance with large data sets will be pretty poor.

There may be a way, using XML's proposed xml:id attribute (see or XML Schema's xs:id attribute, to specify a unique identifier for each record. Once you have that, and when the parser knows your document has it defined and is in sorted order, your parser may then be "smart" and use a binary search, taking O(log n) time.

It might be worth someone doing an experiment (sorry, I don't have time -- too busy).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top