Original Post
Hey all, I've written an XNA pipeline routine to process an XML file representing a level in my game. I have a section in the XML file that contains repetitive tags and I've been having a problem figuring out the "right code syntax/xml format" to compile and read it. If someone could review the following small snippets of code and recommend what to try I'd appreciate it: I'm currently receiving a compile error during the XML deserializing: error: Error 1 There was an error while deserializing intermediate XML. 'Element' is an invalid XmlNodeType. Line 26, position 8. C:\devel\BlockBuster\XNA 2.0\BlockBusterXNA2 - single player advanced XML\BlockBusterXNA2\Content\Levels\BlockBUSTERLevel1.xml 26 8 BlockBusterXNA2 When I click on the error it's sitting on the first "b" of as highlighted below Also, within the BLOCKS section, I want to repeat the structure N times, hence the usage of LIST. I also tried with - …
- …
but still continue to receive errors. If anyone has any recommendations I’d really appreciate it. ------------------------------------------------- public class Level { public struct sBlockLoadMaster { public int blockid; public string modelname; public float strength; public Vector4 particleexplosioncolor; public string particleexplosiontexture; }; public int levelid = 0; public string levelname = ""; public int leveltype = 0; public List blocks = new List(); } // End Level Class XML File: 1 Training Level 1 0 0 <----------- Error on this line between < and b max9_neongreen_box 15.0 152 251 152 255 destroy // READER public class LevelContentReader : ContentTypeReader { protected override Level Read( ContentReader input, Level existingInstance) { Level level = new Level(); level.levelid = input.ReadInt32(); level.levelname = input.ReadString(); level.leveltype = input.ReadInt32(); level.blocks = input.ReadObject
- >(); return level; } } // WRITER namespace XMLLevelWriter { #region LevelContentWriter [ContentTypeWriter] public class LevelContentWriter : ContentTypeWriter
- >(value.blocks); } public override string GetRuntimeReader( TargetPlatform targetPlatform) { return typeof(LevelContentReader).AssemblyQualifiedName; } } // Class XMLLevelWriter #endregion // LevelLevelWriter} } // Namespace: XMLLevelWriter