I'm implementing a program which acts as a client to some existing software. The protocol is defined using an XML
schema, and it includes multidimensional arrays.
The .net XmlSerializer
cannot handle those - it's a known issue.
Is there a way to extend XmlSerializer
so I can implement handling for this, or is there a full (free or commercial) replacement for XmlSerializer
that can handle multidimensional arrays?
SharpSerializer
does not seem to create schema defined XML, but uses it's own serialization format.
I guess I can use sgen.exe
to generate the serializer code, and then edit that manually afterwards to add the necessary handling, but I would like to avoid that.
If you have control to change your schema, you could try use jagged arrays instead of multidimensional arrays.
string[][]
instead ofstring[,]
or use something like
List<List<T>>
You can create your own custom class which flattens the multidimensional array.
Alternatively, use XmlIgnore on your class, flatten the multidimensional array into a standard array (as proposed here by Marc Gravell)