Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've been trying so long to use this modified version of GLEED2D that includes WP7 support,

I'm stuck into loading the level into my game, now my Game1.cs class has the following:

    protected override void Initialize()
    {

        Stream stream = TitleContainer.OpenStream("Content/leveltest.xml");
        XElement xml = XElement.Load(stream);
        level = LevelLoader.Load(xml);
        base.Initialize();
    }

I included the XML file of my level into Content Directory, when I try to build the solution, It gives this error:

XML is not in the XNA intermediate format. Missing XnaContent root element.

I didn't find any reference on how to fix it on the developer's blog or the github WiKi

Any Idea?

share|improve this question
    
You need to look at this tutorial for loading XML in XNA: msdn.microsoft.com/en-us/library/ff604979.aspx –  John McDonald Jan 29 '12 at 5:54
    
@JohnMcDonald I just did that, what should I replace the "<Asset Type="MyDataTypes.PetData[]">" in the example with ? –  Sherif Maher Eaid Jan 29 '12 at 6:21
add comment

1 Answer

up vote 4 down vote accepted

The problem is that you're trying to build the XML file using the XNA's Content Pipeline. However, in the source code you posted, the XML file is being loaded at runtime using the LINQ to XML API (XDocument) so it doesn't need to go through the content pipeline.

To solve the problem, go to the Solution Explorer, browse into your Content project to your XML file, and then on its Properties, change the Build Action property from Compile to Content, and also enable the Copy to Output Directory property. See picture below:

enter image description here

This way your XML file will still be copied to the Content folder, without being built by the XNA's Content Pipeline.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.