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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:50:14+00:00 2026-06-10T09:50:14+00:00

So I’m having trouble converting my game over to XML/Linq, which I need to

  • 0

So I’m having trouble converting my game over to XML/Linq, which I need to do because the project has expanded. It seems like such a simple problem, but the XML file I’ve loaded into my content is not found. If I try to load the XML file from the directory, it works fine, but how do I load from the Content files I’ve included in the project?

Do I need to somehow apply Content.Load to be able to access the file, or flag the file differently? I’ve currently got the flags set to Content (not compile), Content Importer is XML Content – XNA Framework, Content Processor – No Processing Required, Copy to Output Directory – Copy Always.

Thanks for the help. I feel a bit dumb having to ask. I put 3 z’s next to the line in question. Thanks again!

class GameObject
{
    public string objectType;
    public string objectID;
    public bool isActive;
}
struct option
{
    public string optionName;
    public string type;
    public string command;
}
class TitleScreen : GameObject
{
    XDocument TitleData;
    public int totalOptions;
    List<option> optionsShared = new List<option>();
    int currentDrawObject;
    public void Init(string TitleID)
    {
        objectType = "TitleScreen";
        objectID = "Title";
        isActive = true;
zzz            TitleData = XDocument.Load("TitleData.xml");   zzz
        var options = 
            from x in TitleData.Descendants("option")
            select new
            {
                type = x.Descendants("otype").First().Value,
                optionName = x.Descendants("oname").First().Value,
                command = x.Descendants("ocommand").First().Value
            };
        foreach (var x in options)
        {
            optionsShared.Add( new option 
            {optionName = x.optionName,
            type = x.type,
            command = x.command
            });
        }
        foreach (var option in options)
        {
            totalOptions += 1;
        }
    }
    public void Draw(SpriteBatch sb, SpriteFont sf)
    {
        currentDrawObject = 0;
        sb.Begin();
        foreach (var option in optionsShared)
        {
            currentDrawObject += 1;
            sb.DrawString(sf, option.optionName, new Vector2(50, 100 * currentDrawObject), Color.White);
        }
        sb.End();
    }

}
  • 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-10T09:50:15+00:00Added an answer on June 10, 2026 at 9:50 am

    you have to mark your xml file “TitleData.xml” as Content and Always Copy.

    be carefull if you set this xml in a specific folder in output you will have to specify path
    that is

    TitleData = XDocument.Load(@"yourfolder\TitleData.xml");
    

    in debug mode you can see setting a break point application path to know how to get good path

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.