Hi
I am trying to use XMLSerialzer class to generate serializable class for
following schema.
<xs:element name="KeyIdentifiers" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifier" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyIdentifierField" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
After generating class using xsd.exe I see following code in generated class
class GObject
{
....
....
public GObjectEntityKeyIdentifiersKeyIdentifier[][] KeyIdentifiers;
....
.....
}
Now when I try to create XMLSerialzer object function fails.
XmlSerializer xs = new XmlSerializer(typeof(GLibrary.GObject));
When I checked intermediate .cs file generated bu XMLSerializer then I found
following line due to which compilation fails resulting in failure of
XMLSerialzer creation.
Write13_GObjectEntityKeyIdentifiersKeyIdentifier(@"KeyIdentifier",
@"http://Genie.org/Entity.xsd",
((GLibrary.GObjectEntityKeyIdentifiersKeyIdentifier)a[ia]), false, false);
It seems source generation of XMLSerializer does not handle two dimensional
arrays correctly because when I remove maxOccurs="unbounded" from
KeyIdentifiers element then everything works fine becuase then it is only
single dimension array.
Regards
Dino Chiesa [Microsoft] - 09 Oct 2003 18:47 GMT
Can you post a schema and code that shows the error? A small test case is
best.
The fragment you posted isn't a complete schema, something is missing.
Also,
Adding the NestingLevel=1 attribute to the jagged array may fix the problem.
Consult the archives for more details.
-Dino
> Hi
>
[quoted text clipped - 52 lines]
>
> Regards