Существует ли готовый способ работы с <xsd:list>
в XmlSerializer?
В моем случае я получил список double
, что-то вроде этого:
<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"/>
Экземпляр может выглядеть так: <pos>10.3 20.2 -2.4</pos>
Я пытался заставить xsd.exe раскрыть некоторые секреты, но он сгенерировал это .., что не получается:
private double[] textField;
[System.Xml.Serialization.XmlTextAttribute()]
public double[] Text {
get {
return this.textField;
}
set {
this.textField = value;
}
}
Исключение:
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.
Обратите внимание, что я использую существующие схемы и никак не могу повлиять на дизайн.