Is there an out-of-the-box way to deal with <xsd:list>
in XmlSerializer ?
In my case I got a list of double
, something like this:
<xs:complexType name="PositionType">
<xs:simpleContent>
<xs:extension base="doubleList">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="doubleList">
<xs:list itemType="xs:double"/>
</xs:simpleType>
<xs:element name="Test" type="PositionType"/>
An instance may look like this: <pos>10.3 20.2 -2.4</pos>
I tried to make xsd.exe reveal some secrets, but it generated this.. which fails:
private double[] textField;
[System.Xml.Serialization.XmlTextAttribute()]
public double[] Text {
get {
return this.textField;
}
set {
this.textField = value;
}
}
Exception:
System.InvalidOperationException: Member 'Text' cannot be encoded using the XmlText attribute. You may use the XmlText attribute to encode primitives, enumerations, arrays of strings, or arrays of XmlNode.
Note that I am using existing schemas and have no way to influence design.