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

  • SEARCH
  • Home
  • 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 8314603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:52:37+00:00 2026-06-08T20:52:37+00:00

This is .NET 2.0 project. First of all the xml i what to parse:

  • 0

This is .NET 2.0 project. First of all the xml i what to parse:

<?xml version="1.0" standalone="yes"?>
<DocumentElement>
  <diagramer>
    <PKTABLE_NAME>TECH_Y_Category</PKTABLE_NAME>
    <FKTABLE_NAME>TECH_File</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>TECH_File</PKTABLE_NAME>
    <FKTABLE_NAME>TECH_Version</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>TECH_Group</PKTABLE_NAME>
    <FKTABLE_NAME>TECH_D_Group_File_Version</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>TECH_Layout</PKTABLE_NAME>
    <FKTABLE_NAME>TECH_File</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>CK_List</PKTABLE_NAME>
    <FKTABLE_NAME>CK_Vote</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>CK_List</PKTABLE_NAME>
    <FKTABLE_NAME>CK_Score</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>TECH_Page</PKTABLE_NAME>
    <FKTABLE_NAME>TECH_Page</FKTABLE_NAME>
  </diagramer>
  <diagramer>
    <PKTABLE_NAME>CK_List</PKTABLE_NAME>
    <FKTABLE_NAME>Comments</FKTABLE_NAME>
  </diagramer>
</DocumentElement>

As you can see some PKTABLE_NAME values are the same.
Im looping through that xml using code below:

StringBuilder sb = new StringBuilder();
foreach (XmlNode items in diagramTables)
{
  string pkTable = items["PKTABLE_NAME"].InnerText.Replace("_",@"\_");
  string fkTable = items["FKTABLE_NAME"].InnerText.Replace("_",@"\_");

  sb.Append(pkTable);
  sb.Append(" got ");
  sb.Append( fkTable + Environment.NewLine);

}

Its not exaclly what i want to achive. I want to have all values but only once (i dont want to repeat them). after all i want to write sometingingh like this from xml above:

  • TECH_Y_Category got
    TECH_File
  • TECH_File got TECH_Version
  • TECH_Group got TECH_D_Group_File_Version
  • TECH_Layout got TECH_File
  • CK_List got CK_Vote | CK_Score | Comments
  • TECH_Page got TECH_Page

I hope you understand what im trying to achieve.

EDIT.

Code from Morawski worked perfectly for me so problem is solved ;).

  • 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-06-08T20:52:39+00:00Added an answer on June 8, 2026 at 8:52 pm

    Something like:

    Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>();
    foreach (XmlNode items in diagramTables)
    {
      string pkTable = items["PKTABLE_NAME"].InnerText.Replace("_",@"\_");
      string fkTable = items["FKTABLE_NAME"].InnerText.Replace("_",@"\_");
      if (!dict.ContainsKey(pkTable))
      {
        dict.Add(pkTable, new List<string>());
      }
      if (!dict[pkTable].Contains(fkTable))
      {
          dict[pkTable].Add(fkTable);
      }
    }
    sb.Append("========================================================="); // making it easier for you
    foreach(KeyValuePair<string, List<string>> kvp in dict)
    {
      sb.Append(kvp.Key);
      sb.Append(" got ");
      sb.AppendLine(String.Join("|", kvp.Value.ToArray()));
    }
    sb.Append("========================================================="); // making it easier for you
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not at all familiar with ASP.NET membership/roles. This is my first time
First of all, I upgraded my project form .NET 3.5 to 4.0 recently. I
First of all, I'll admit this is a school project, so I need more
I'm relatively new to C# and .Net, and this is my first WPF project,
In my ASP.NET project. I put my css file in \App_Themes\Default\theme.css This is right
iv used the built in membership control for my ASP.net project, this create the
I've got this ASP.NET 2.0 website project in Visual Studio that I've been working
In an ASP.NET MVC3 project I have a structure like this: Core.csproj -> 3rdparty1.dll
Consider the scenario of upgrading an ASP.NET MVC project. This question is around up-converting
folks! I have project in cc.net and this project nay start by 3 ways

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.