Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing XML through MGCB - "The XML element 'item' is required!" #3439

Closed
foxoftheasterisk opened this issue Jan 21, 2015 · 3 comments · Fixed by #3482
Closed

Error importing XML through MGCB - "The XML element 'item' is required!" #3439

foxoftheasterisk opened this issue Jan 21, 2015 · 3 comments · Fixed by #3482
Labels
ContentPipeline Content processing issues

Comments

@foxoftheasterisk
Copy link

I'm importing an XNA project into MonoGame, and getting the following error when trying to build my XML file:

Microsoft.Xna.Framework.Content.Pipeline.InvalidContentException: The Xml element Item is required!

This same file worked in XNA (and still does) so assuming I'm understanding MonoGame's mission correctly, it should also work in MonoGame.
Unfortunately I have little to no idea why it's not working. I expect the field most likely to be the issue is texture, which is an array of Color; other than that, I got nothing.

The XML file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
  <Asset Type="OutpostLibrary.Material[]">
    <Item>
      <materialName>dirt</materialName>
      <key>dirt</key>
      <transparency>opaque</transparency>
      <solidity>solid</solidity>
      <texture>FF886542 FF916B46 FF916B46 FF886542 FF9F764D FF886542 FF9F764D FF886542 FF916B46 FF916B46 FF916B46 FF9F764D FF886542 FF886542 FF9F764D FF916B46 FF886542 FF916B46 FF916B46 FF886542 FF886542 FF886542 FF916B46 FF9F764D FF9F764D FF9F764D FF886542 FF916B46 FF886542 FF886542 FF886542 FF916B46 FF9F764D FF916B46 FF886542 FF916B46 FF9F764D FF916B46 FF916B46 FF886542 FF886542 FF916B46 FF9F764D FF886542 FF886542 FF9F764D FF916B46 FF886542 FF916B46 FF916B46 FF916B46 FF9F764D FF886542 FF916B46 FF916B46 FF886542 FF9F764D FF916B46 FF9F764D FF9F764D FF916B46 FF916B46 FF9F764D FF916B46 FF916B46 FF916B46 FF886542 FF916B46 FF916B46 FF886542 FF9F764D FF916B46 FF886542 FF9F764D FF9F764D FF886542 FF886542 FF916B46 FF9F764D FF916B46 FF886542 FF9F764D FF886542 FF916B46 FF916B46 FF9F764D FF886542 FF916B46 FF886542 FF886542 FF886542 FF9F764D FF916B46 FF9F764D FF9F764D FF886542 FF916B46 FF9F764D FF886542 FF886542 FF916B46 FF916B46 FF9F764D FF886542 FF9F764D FF9F764D FF886542 FF916B46 FF886542 FF886542 FF916B46 FF916B46 FF9F764D FF886542 FF886542 FF886542 FF9F764D FF886542 FF916B46 FF9F764D FF916B46 FF886542 FF9F764D FF916B46 FF916B46</texture>
    </Item>
    <Item>
      <materialName>air</materialName>
      <key>air</key>
      <transparency>transparent</transparency>
      <solidity>gas</solidity>
      <texture>00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000</texture>
    </Item>
    <Item>
      <materialName>void</materialName>
      <key>none</key>
      <transparency>transparent</transparency>
      <solidity>vacuum</solidity>
      <texture>00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000</texture>
    </Item>
  </Asset>
</XnaContent>

And the definition of OutpostLibrary.Material:

    public class Material
    {
        public static Material[] matList;
        public static Dictionary<String, Material> materials;

        public String materialName;
        public String key;
        public Transparency transparency;
        public Solidity solidity;
        public Color[] texture;

        public Material()
        {
            texture = new Color[Navigation.VoxelsPerEdge * Navigation.VoxelsPerEdge * Navigation.VoxelsPerEdge];
        }

        public Color this[int i, int j, int k]
        {
            get
            {
                return texture[i * Navigation.VoxelsPerEdge * Navigation.VoxelsPerEdge + j * Navigation.VoxelsPerEdge + k];
            }
            set
            {
                texture[i * Navigation.VoxelsPerEdge * Navigation.VoxelsPerEdge + j * Navigation.VoxelsPerEdge + k] = value;
            }
        }
    }

    public enum Transparency { transparent, translucent, opaque }
    public enum Solidity { solid, liquid, gas, vacuum, plasma }

This might be, but probably isn't, related to issue #3404.

@tomspilman
Copy link
Member

Thanks @Littlebeast . This should make it easy to build a unit test to figure out this bug.

@tomspilman tomspilman added the ContentPipeline Content processing issues label Jan 22, 2015
@tgjones
Copy link
Contributor

tgjones commented Feb 1, 2015

This is caused by the indexer, which is ignored by XNA but not by MG. I'm working on a PR now.

@tomspilman
Copy link
Member

@Littlebeast - The fix was merged... let us now if you have more trouble with this.

linhhdinh pushed a commit to linhhdinh/MonoGame that referenced this issue Mar 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ContentPipeline Content processing issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants