I'm using an .xsd schema like this
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" 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="SceneName" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="PlayerName" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="Button" minOccurs="0" maxOccurs="unbounded" >
<xs:complexType>
<xs:sequence>
<xs:element name="ButtonText" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="NextScene" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Scene" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
This was autogenerated by Visual Studios xsd.exe. Then i use xsd2code to make it to a .designer.cs file. I set xsd2code so it creates serializers and makes complex type structures to arrays.
Now i deserialzie an xml and create my scenefile, my subobjekts like playername are all correct, even if they have subobjects as long as they are set maxoccurence=1 and minoccurence=0. Exept for my Arrays like Button in the aboce example, I thought i would get an array like this: scene.Button[i].Buttontext. Well, which i don't get. I only get i don't know what thats why i have an screenshot here.
and he throws an IndoexoutofRange Error. So what did i do wrong?
Btw here my example.xml
<?xml version="1.0" encoding="utf-8"?>
<Scene>
<SceneName>SceneName1</SceneName>
<PlayerName>PlayerName1</PlayerName>
<Button>
<ButtonText>ButtonText1</ButtonText>
<NextScene>NextScene1</NextScene>
</Button>