I am trying to read XML document. My XML:
<?xml version="1.0" encoding="utf-8"?> <SplashScreen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Path>SplashScreen/Image-King</Path> </SplashScreen>
My code which is reading XML:
XmlGameScreen = new XmlManager<GameScreen>(); XmlGameScreen.Type = currentscreen.Type; currentscreen = XmlGameScreen.Load("LoadXML/SplashScreen.xml");
And
public Type Type; public T Load(string path) { T instance; using (TextReader textreader = new StreamReader(path)) { XmlSerializer xml = new XmlSerializer(Type); instance = (T)xml.Deserialize(textreader); } return instance; }
I am getting error on instance = (T)xml.Deserialize(textreader);
Is my XML document wrong? I am trying to read <Path>
. Update : My Internal Exception: Cannot serialize member 'MyRPGgame.SplashScreen._image'
of type 'Microsoft.Xna.Framework.Graphics.Texture2D'
An error was detected while trying to load an XML schema file. This normally means that there was a problem locating the document (either the document does not exist or there is a problem with permissions) or that the schema itself is in error.
Serialization is a process by which an object's state is transformed in some serial data format, such as XML or binary format. Deserialization, on the other hand, is used to convert the byte of data, such as XML or binary data, to object type.
In my case it appears one of the Visual Studio 2017 version 15.5 updates caused this error when trying to open SSRS projects. The solution is to delete the *.rptproj.rsuser file from the project folder and try again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With