Note that there are some explanatory texts on larger screens.

plurals
  1. POError while deserializing intermediate XML. Cannot find type
    text
    copied!<p>The whole error message is here:</p> <pre><code>There was an error while deserializing intermediate XML. Cannot find type "WindowsGame1.Tile". </code></pre> <p>I'm making an XNA game, and right now I'm trying to load in a tile-based level from an xml file. Right now, my xml file looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;XnaContent&gt; &lt;Asset Type="WindowsGame1.Tile"&gt; &lt;Tile&gt; &lt;X&gt;0&lt;/X&gt; &lt;Y&gt;0&lt;/Y&gt; &lt;ImageName&gt;grass-tile&lt;/ImageName&gt; &lt;/Tile&gt; &lt;/Asset&gt; &lt;/XnaContent&gt; </code></pre> <p>And my C# file looks like this:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace WindowsGame1 { public class Tile { public int x; public int y; public string imageName; public int X { get { return x; } set { x = value; } } public int Y { get { return y; } set { y = value; } } public string ImageName { get { return imageName; } set { imageName = value; } } } } </code></pre> <p>I have a class that uses the XPath libraries to parse the xml file and make Tile's out of it, but it's all commented out right now because the xml stuff doesn't work anyways. In my Game1 class I tried importing:</p> <pre><code>using WindowsGame1.Tile; </code></pre> <p>and referencing:</p> <pre><code>Tile tile; </code></pre> <p>This tile class, as per a suggestion I found while trying to find a solution to this, but I'm still getting the same error, and my game won't build. Anyone know what I need to change to get this XML stuff working?</p> <p>Here's what the code that should be parsing the XML should look like, though at the moment, it's all commented out until I can get it to compile.</p> <pre><code>namespace WindowsGame1 { class ActionScreen : GameScreen { public ActionScreen(Game game, SpriteBatch spriteBatch, String file, AnimatedSprite sprite) : base(game, spriteBatch) { this.file = file; this.sprite = sprite; initializeTiles(); } private void initializeTiles() { XPathDocument doc = new XPathDocument(file); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator iter = nav.Select("tile"); while (iter.MoveNext()) { int x, y; string fileName; x = int.Parse(iter.Current.GetAttribute("X", "")); y = int.Parse(iter.Current.GetAttribute("Y", "")); fileName = iter.Current.GetAttribute("ImageName", ""); Console.WriteLine(x + " " + y + " " + fileName); } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload