Suppose i have an XML file, that i use as local database, like this):
<root>
<address>
<firstName></firstName>
<lastName></lastName>
<phone></phone>
</address>
</root>
I have a couple of questions:
1. What will be a fastest way to find address(or addresses) in XML where firstName contains ‘er’ for example?
2. Is it possible to do without whole loading of XML file in memory?
P.S. I am not looking for XML file alternatives, ideally i need a search that not depend on count of addresses in XML file. But i am realist, and it seems to me that it not possible.
Update:
I am using .net 4
Thanks for suggestions, but it’s more scientific task than practical.. I probably looking for more fastest ways than linq and xmltextreader.
LINQ to Xml works pretty fine:
UPDATE: Try to look at this question on StackOverflow: Best way to search data in xml files?.
Marc Gravell’s accepted answer works using SQL indexing:
UPDATE 2: Read also another link taken by the previous question that explains how the structure of the XML affects performances: http://www.15seconds.com/issue/010410.htm