Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:33:54+00:00 2026-06-10T06:33:54+00:00

I created an .xsd from an xml file using XSD.Exe from the Visual Studio

  • 0

I created an .xsd from an xml file using XSD.Exe from the Visual Studio Tools (now Win 7 SDK Tools).
My .xsd file:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="SceneFile" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"   xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Scene">
<xs:complexType>
  <xs:sequence>
    <xs:element name="VNESceneName" type="xs:string" minOccurs="0" maxOccurs="1"/>
    <xs:element name="VNEPlayerName" type="xs:string" minOccurs="0" maxOccurs="1"/>
    <xs:element name="VNEButtons" minOccurs="0" maxOccurs="1">

(cutted sicne it’s too long)
I then used XSD2Code (an add-in for VS) to create an .Designer.cs file:

namespace VNEngine
{
using System;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Collections;
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
using System.Text;
using System.Collections.Generic;


public partial class Scene
{

    private string vNESceneNameField;
    private string vNEPlayerNameField;
    private List<SceneVNEButton> vNEButtonsField;
    private SceneVNETextBox vNETextBoxField;
    private SceneVNEBackground vNEBackgroundField;
    private List<SceneVNESprite> vNESpritesField;
    private SceneVNEMusic vNEMusicField;
    private static System.Xml.Serialization.XmlSerializer serializer;

    public Scene()
    {
        this.vNEMusicField = new SceneVNEMusic();
        this.vNESpritesField = new List<SceneVNESprite>();
        this.vNEBackgroundField = new SceneVNEBackground();
        this.vNETextBoxField = new SceneVNETextBox();
        this.vNEButtonsField = new List<SceneVNEButton>();
    }

    public string VNESceneName
    {
        get
        {
            return this.vNESceneNameField;
        }
        set
        {
            this.vNESceneNameField = value;
        }
    }

(cutted sicne it’s too long)

Now I want to create a “Scene”(the root xml tag) in my C# code:

            Scene testscene = new Scene();
            testscene.VNEPlayerName = "hallo";

All up to this point is Working, but when i want to save or Serialize (or Deserialize) like this:

            testscene.SaveToFile(@"Content/Scenes/testscene.xml");

And now when executing I get an Error at the Line (in SceneFiles.designer.cs)

    private static System.Xml.Serialization.XmlSerializer Serializer
    {
        get
        {
            if((serializer == null))
            {
       --->  serializer = new System.Xml.Serialization.XmlSerializer(typeof(Scene));
            }
            return serializer;
        }
    }

And my Error goes like this:

//

Eine nicht behandelte Ausnahme des Typs
“System.InvalidOperationException” ist in System.Xml.dll aufgetreten.

Zusätzliche Informationen: Fehler beim Reflektieren des Typs
‘VNEngine.Scene’.

//

My rough english translation:

A not handled Exception: System.InvalidOperationException appeared in
System.Xml.dll Additional Information: Error at Reflecting the type
‘VNEngine.Scene’

//

Does anyone know what I made wrong?

The same thing worked with an smaller not as complex and not with xsd.exe generatet .xsd stylesheet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:33:56+00:00Added an answer on June 10, 2026 at 6:33 am

    Ok, i found it, XSD2Code does have an option GenerateXMLAttributes which needs to be set true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an XSD file from Visual Studio and can generate a sample XML
I have generated an XSD file from an XML snippet using xsd.exe /out What
I'm using XmlSerializer with classes created from a xsd using xsd.exe . It has
I'm having trouble creating an XML file from XSD using JAXB below is the
I've created an .xsd file and then used XSD.exe to generate the .cs file
I am new to xml's. I have used xsd.exe to create a .xsd file
I am creating an XML file in C# using a XSD Schema of an
Whenever I have needed to create a class file from an XML XSD schema,
I have a simple XML file here which I converted to XSD with xsd.exe
I have created a C# class file by using a XSD-file as an input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.