Hi all,

I am new to xml.

I am developing vc++ application. Here, I am using one text file
for storing data. I am searching from this text file based on search key.
This is sequential search.

Data is like this:

Data.txt
--------
root\Level1\Level2\xyz1
root\xyz2
root1\Level1\xyz3
root1\Level1\Level2\xyz4
root\Level1\xyz5

If user wants "root\Level1", I am searching all (5) records, then I am
returing 1,5 records. In the average and worst case, this is not optimal.

In my application, NoOfRecords may be more than 2,00,000 records.

If I implemented this in tree stucture format in MSXML, Will it imporve
the performance? (i mean, searching from xml document)

Any other alternatives are there?

Please suggest me.

--
Thanks & Regards,
John.

RE: xml with vc++ by Goldbach

Goldbach
Sat May 26 03:52:00 CDT 2007

All XML parsers are sequential read, unless you write your owner parser.
--
If the message was helpful to you, please click "Yes", next to "Was this
post helpful to you?"

Regards,
Goldbach


"John" wrote:

> Hi all,
>
> I am new to xml.
>
> I am developing vc++ application. Here, I am using one text file
> for storing data. I am searching from this text file based on search key.
> This is sequential search.
>
> Data is like this:
>
> Data.txt
> --------
> root\Level1\Level2\xyz1
> root\xyz2
> root1\Level1\xyz3
> root1\Level1\Level2\xyz4
> root\Level1\xyz5
>
> If user wants "root\Level1", I am searching all (5) records, then I am
> returing 1,5 records. In the average and worst case, this is not optimal.
>
> In my application, NoOfRecords may be more than 2,00,000 records.
>
> If I implemented this in tree stucture format in MSXML, Will it imporve
> the performance? (i mean, searching from xml document)
>
> Any other alternatives are there?
>
> Please suggest me.
>
> --
> Thanks & Regards,
> John.
>

Re: xml with vc++ by Igor

Igor
Sat May 26 08:17:27 CDT 2007

"John" <John@discussions.microsoft.com> wrote in message
news:0BA33FFF-6505-49E8-9411-BCBCAF4ED21E@microsoft.com
> Data.txt
> --------
> root\Level1\Level2\xyz1
> root\xyz2
> root1\Level1\xyz3
> root1\Level1\Level2\xyz4
> root\Level1\xyz5
>
> If user wants "root\Level1", I am searching all (5) records, then I am
> returing 1,5 records. In the average and worst case, this is not
> optimal.

You want to build a trie, or a Patricia tree.

http://en.wikipedia.org/wiki/Trie
http://en.wikipedia.org/wiki/Radix_tree

These data structures would allow you to find all strings beginning with
a given prefix in time proportional to the length of the prefix but
independent of the number of strings in the collection.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925