Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 251393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:35:26+00:00 2026-05-11T21:35:26+00:00

I have the following set of data <ids> <id1 attr1=value1 attr2=value2 /> <id2 attr3=value3

  • 0

I have the following set of data

<ids>
   <id1 attr1="value1" attr2="value2" />
   <id2 attr3="value3" attr4="value4" />
   <id3 attr2="value6" attr5="value7" />
</ids>

Basically, it’s an XML that can have any node name with any attribute name with any attribute value.

After parsing the XML, I store the attribute data in a Dictionary.
Then I store that same Dictionary as a value with the node name as a key.
So my data structure would be a Dictionary<string, Dictionary<string, string>> (let’s give this a variable name called “dict”)
So if I wanted to get the value for attr2 in the id1 node, I would do:

string value = dict["id1"]["attr2"];
// value will be value2

I think this is a pretty simple and workable solution for my needs, but there just seems to be this voice at the back of my head telling me that there is a different data structure or simpler solution that I’m missing out on. What does everyone think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:35:26+00:00Added an answer on May 11, 2026 at 9:35 pm

    I think your solution is a good one. It will provide very fast lookups, and matches exactly to your domain.

    Is your main problem with the nested dictionaries? If so, I would suggest that you not worry about it – using collections of collections is often a very useful tool.

    My only complaint would be this: If you’re not using this frequently, you’re going to be loading a lot of information into a data structure that may be unncessary. If this is for one time lookups, leaving it in XML and using XPath queries may be a more optimal solution than pre-parsing and loading the entire thing into memory. If you’re querying this frequently, though, this is a more optimal solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following set of data: ID | CREATED | USER -------------------------- 1
I have the following data set structure: date time_in_hours price Sep 03 08 9.76
I have the following data set that I am trying to plot with ggplot2,
I have the swiss data set provided by R, which has the following form:
I have some following set of data from where I want to select Top
I have the following data set with the 3rd field consists of 0's and
I have a following data set: A B N 1 3 10 2 3
I'm trying to map a Dictionary containing Lists. I have the following set of
I'm using log4Net for my logging. I also have the following set... <log4net debug=true>
I have the following function set up to sequentially fade in divs (with class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.