CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: handle list of data an fast search

  1. #1
    Join Date
    May 2013
    Posts
    11

    handle list of data an fast search

    i want to create some data structure that will amount of 20K xml.
    xml structure will be of type :
    <XML><GUID>fcf2664e-d641-48a7-a1aa-2e8fef5145e6</GUID><DATA>.....</DATA><XML>
    <XML><GUID>62040b2d-52a4-4ce0-814f-ff5530dde6fc</GUID><DATA>.....</DATA><XML>
    and so on...
    i want to achive 2 things:
    1) i want to remove xml after XX minutes (xx will be general number for all the XML)
    2) i want to search over the structure and find the xml by its GUID.

    whats the best way to implement this?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,305

    Re: handle list of data an fast search

    First of all, the xml you posted isn't valid xml because it's missing closing xml tags (e.g. </XML>).

    That being said, do you have control over the xml schema? If so, I would suggest you change the schema to have the guid/data pair as a single node of the xml (rather than a data node following a guid node).

    Something like (...please ignore the names I've chosen):

    Code:
    <nodes>
      <node guid="fcf2664e-d641-48a7-a1aa-2e8fef5145e6">
        <data>....</data>
      </node>
      <node guid="62040b2d-52a4-4ce0-814f-ff5530dde6fc">
        <data>....</data>
      </node>
    </node>
    Once you have the xml in a format like this (if it's possible), then you can use Xml serialization to read it into a class.

    In terms of fast lookup, you can then put each node into a dictionary object and use the guid as the key for fast retrieval.

    If this sounds interesting, I can elaborate further.

  3. #3
    Join Date
    May 2013
    Posts
    11

    Re: handle list of data an fast search

    very interesting, i didnt think of serialization, how execlly will it help?
    can i maybe combine it with saving the xml as compressed?

  4. #4
    Join Date
    May 2013
    Posts
    11

    Re: handle list of data an fast search

    the exect xml structure is like this:
    <XML>
    <HEAD>
    <GUID>fcf2664e-d641-48a7-a1aa-2e8fef5145e6</GUID>
    </HEAD>
    <BODY>
    <DATA>.....</DATA>
    </BODY>
    </XML>

    and under the data there are more nodes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)