I'm trying to load an XML file into my MonoGame game via the pipeline but I am getting an error.
'Element' is an invalid XmlNodeType. Line 10, position 6.
I have created my classes for the XML File in an external portable class library project and added that DLL to the pipeline content references. But when I try to build the XML file within the MonoGame Pipeline application I get the above error.
Any Ideas?
The XML and Class code are below
MainMenu.xml (I have marked the error line with an xml style comment, comment not in the actual file)
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:ns="Microsoft.Xna.Framework">
<Asset Type="Menu">
<Title>Main Menu</Title>
<Background>
<Type>animation</Type>
<Data>MainMenuBackground</Data>
</Background>
<Options>
<Option> <!-- Error Here -->
<Type>text</Type>
<Name>new</Name>
<Disabled>false</Disabled>
<Text>New Game</Text>
<Action>newGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>save</Name>
<Disabled>true</Disabled>
<Text>Save Game</Text>
<Action>saveGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>load</Name>
<Disabled>false</Disabled>
<Text>Load Game</Text>
<Action>loadGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>exit</Name>
<Disabled>false</Disabled>
<Text>Exit Game</Text>
<Action>exitGame</Action>
</Option>
</Options>
<Buttons>
<Keyboard>
<Accept>Enter</Accept>
<Cancel>Esc</Cancel>
</Keyboard>
<Controller>
<Accept>A</Accept>
<Cancel>B</Cancel>
</Controller>
</Buttons>
</Asset>
</XnaContent>
Menu.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Menu
{
public String Title;
public Background Background = new Background();
public Option[] Options = new Option[] { };
public Buttons Buttons = new Buttons();
}
}
Background.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Background
{
public String Type;
public String Data;
}
}
Option.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Option
{
public String Type;
public String Name;
public Boolean Disabled;
public String Text;
public string Action;
}
}
Buttons.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Buttons
{
public ControlButtons Keyboard = new ControlButtons();
public ControlButtons Controller = new ControlButtons();
}
}
ControlButtons.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class ControlButtons
{
public String Accept;
public String Cancel;
}
}