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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:55:33+00:00 2026-05-18T10:55:33+00:00

This is my first post and I have am concerned that some might think

  • 0

This is my first post and I have am concerned that some might think I have bothered trying to solve the problem myself, so forgive me if I rant on. I am currently trying to develop a set of functions for importing an xml document and creating a basic object from it.

Currently I have this code looking for all xml files in a directory and displaying the file names in a listbox. Overall there’s about 10,000 xml files so it take a while to load.

public void CreateLibrary()
{
        List<string> fixtureList = new List<String>();
        string[] dirs = Directory.GetFiles(@"C:\Windows.old\Users\Michael\Desktop\Application_ DEV\XMLData", "*.xml",
                                     SearchOption.AllDirectories);
foreach (string dir in dirs)
{
            string fixture = System.IO.Path.GetFileName(dir);


            lbxLibrary.Items.Add(fixture);
}

What I would like to happen is when the user selects a new listbox item, the url for the file is passed to a GetData function. see below:

selection change event

private void lbxLibrary_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
    {
            Fixture fixture = new Fixture();
           lblFixtureName.Text = fixture.GetModelName("C:\Windows.old\Users\Michael\Desktop\Application_ DEV\XMLData\\ExampleData.xml");
    }

GetModelName function – this is in a different class.

        public string GetModelName(string url)
    {
        //Import fixture xml 
        XmlDocument xml = new XmlDocument();
        xml.LoadXml(url);

        XmlNodeList xnList = xml.SelectNodes("/FixtureModel/");

        foreach (XmlNode xn in xnList)
        {
            ModelName = xn["ModelName"].InnerText;
        }

        return ModelName;

    }

I current get an ‘XmlException was unhandled’ error in the GetModelName function.

The exact line I am having issues appears to be where I am passing the directory location in.

xml.LoadXml(url);

Does anybody have any ideas on what I am doing wrong.

  • 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-18T10:55:33+00:00Added an answer on May 18, 2026 at 10:55 am

    1) LoadXml is used to parse a string containing an XML document. Load is used to parse XML retrieved from a URL.

    2) You’re not properly escaping characters in the URL, as you will find once you use the right method. Either double your backslashes or prefix the string with an @ sign.

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

Sidebar

Related Questions

this is my first post. I have a huge problem which make me headaches.
Well, this is my first post here and really enjoying the site. I have
This is my first post here and I wanted to get some input from
This is my first post on StackOverflow! I have a background service running and
This is my first post and I'm quite a novice on C++ and compiling
problem euler #5 i found the solution but i don't know why this first
This is my first crack at a method that is run periodically during the
This is my first post on stackoverflow.com so please be kind (rewind) ;) I
this is my first post on stackoverlow and I couldn't find a solution to
This is my first experience using the Zend Framework. I am attempting to follow

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.