0

パイプライン経由で XML ファイルを MonoGame ゲームにロードしようとしていますが、エラーが発生します。

'Element' は無効な XmlNodeType です。行 10、位置 6。

外部ポータブル クラス ライブラリ プロジェクトで XML ファイル用のクラスを作成し、その DLL をパイプライン コンテンツ参照に追加しました。しかし、MonoGame Pipeline アプリケーション内で XML ファイルをビルドしようとすると、上記のエラーが発生します。

何か案は?

XML とクラス コードは次のとおりです。

MainMenu.xml (エラー行を xml スタイルのコメントでマークしました。コメントは実際のファイルにはありません)

<?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;
    }
}
4

1 に答える 1