モデル:XmlDeserialization:xmlconverterためのポイント
[XmlRoot(ElementName = "location", IsNullable = true)]
public class location
{
public string city { get; set; }
public string country { get; set; }
public string street { get; set; }
public string postalcode { get; set; }
[XmlElement(ElementName = "geo:point")]
public geoLocation geo { get; set; }
}
[XmlRoot(ElementName = "geo:point", Namespace="http://www.w3.org/2003/01/geo/wgs84_pos#")]
public class geoLocation
{
[XmlElement(ElementName = "geo:lat", Namespace="http://www.w3.org/2003/01/geo/wgs84_pos#")]
public string lat { get; set; }
[XmlElement(ElementName = "geo:long", Namespace = "http://www.w3.org/2003/01/geo/wgs84_pos#")]
public string lon { get; set; }
}
のxml:
<location>
<city>Moscow</city>
<country>Russian Federation</country>
<street></street>
<postalcode>236000</postalcode>
<geo:point>
<geo:lat>54.727483</geo:lat>
<geo:long>20.501132</geo:long>
</geo:point>
</location>
場所はOKですが、地理 - ではありません。私は何をすべきか? 私は名前空間を消去しようとしたとXmlElement
属性定義の一部として、何の変化location
クラスのgeoLocation
タイプの
地理と間違っている何 - 何を見て期待しましたか? –