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 8198677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:59:58+00:00 2026-06-07T05:59:58+00:00

I am trying to load an XML file onto my GUI using a TreeView

  • 0

I am trying to load an XML file onto my GUI using a TreeView control.
However, I am using a proprietary layout for my XML file.

The XML is structured like this:

<ConfiguratorConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Section>
        <Class ID="Example" Name="CompanyName.Example" Assembly="Example.dll">
            <Interface>
                <Property Name="exampleProperty1" Value="exampleValue" />
                <Property Name="exampleProperty2" Value="exampleValue" />
                <Property Name="exampleProperty3" Value="exampleValue" />
            </Interface>
        </Class>
    </Section>
</ConfiguratorConfig>

I’d like the output to be structured like:

Class "Example"
    Property "exampleProperty1"
    Property "exampleProperty2"
    Property "exampleProperty3"

I’m totally new to using XML. I’ve been searching the web for the past few hours, and none of the results have helped. Some have come close, but perhaps properties won’t show up, or node’s names won’t display, etc.

I’m writing in c# in Visual Studio 2005.
Thanks for the help!

  • 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-07T05:59:59+00:00Added an answer on June 7, 2026 at 5:59 am

    You can iterate through nodes using XmlDocument, you can put this demo in a Main method of a console application:

            string xml = @"<ConfiguratorConfig xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">
    <Section>
        <Class ID=""Example"" Name=""CompanyName.Example"" Assembly=""Example.dll"">
            <Interface>
                <Property Name=""exampleProperty1"" Value=""exampleValue"" />
                <Property Name=""exampleProperty2"" Value=""exampleValue"" />
                <Property Name=""exampleProperty3"" Value=""exampleValue"" />
            </Interface>
        </Class>
    </Section></ConfiguratorConfig>";
    
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
    
            foreach (XmlNode _class in doc.SelectNodes(@"/ConfiguratorConfig/Section/Class"))
            {
                string name = _class.Attributes["ID"].Value;
                Console.WriteLine(name);
    
                foreach (XmlElement element in _class.SelectNodes(@"Interface/Property"))
                {
                    if (element.HasAttribute("Name"))
                    {
                        string nameAttributeValue = element.Attributes["Name"].Value;
                        Console.WriteLine(nameAttributeValue);
                    }
                }
            }
    

    If you’re using version of .NET higher than 3.0 you can use XDocument class (recommended if you can choose).

            XDocument xdoc = XDocument.Parse(xml);
            foreach (XElement _class in xdoc.Descendants("Class"))
            {
                string name = _class.Attribute("ID").Value;
                Console.WriteLine(name);
    
                foreach (XElement element in _class.Descendants("Property"))
                {
                    XAttribute attributeValue = element.Attribute("Name");
                    if (attributeValue != null)
                    {
                        string nameAttributeValue = attributeValue.Value;
                        Console.WriteLine(nameAttributeValue);
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load a gzipped XML file using simplexml_load_file() PHP function, but I
i am trying to load this xml file into the dropdownlist: http://sites.google.com/site/shadchanproject/Home/lots1.xml i want
I am trying to load an XML file into a tree view control, edit
I´m trying to load a XML document in Windows CE using C#, however i
Im trying to load an xml file using the jquery ajax function,it works fine
What I'm trying to do is simple. Load am XML file using ElementTree so
I am trying to load an XML file that asks for a username and
I'm trying to load an XML file with a list of books, I looked
I'm trying to load a simple Xml file (encoded in UTF-8): <?xml version=1.0 encoding=UTF-8?>
I'm trying to use the following code # LOAD XML FILE $XML = new

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.