1
我有這個xml,我試圖反序列化成一個類,但我不能創建適當的類。 XML是:C#反序列化器使用System.Xml.Serialization命名空間前綴問題
<?xml version="1.0" encoding="ISO-8859-1"?>
<AnswersPP s="DSD" lst="11/22/2016 1:08:39 PM" n="1">
<Results xmlns:ssud="www.solacestar.ud>
<ssud:starlist>
<ssud:star id="4234234">
<span style="white-space: nowrap">#NOMA, MAJOR</span>
</<ssud:star>
<ssud:star id="2352234">
<span style="white-space: nowrap">#NOMA, MINOR</span>
</<ssud:star>
</ssud:starlist>
</Results>
<Error/>
</AnswersPP>
我所擁有的是:
[XmlRoot("AnswersPP")]
public class AMDResponseDto
{
[XmlElement("Results")]
public Results Results { get; set; }
[XmlElement("Error")]
public Error Error { get; set; }
}
public class Results
{
[XmlElement("starlist")]
public StarList StarList { get; set; }
}
public class StarList
{
[XmlElement("star")]
public List<Star> Data { get; set; }
}
public class Star
{
[XmlAttribute("id")]
public string Id { get; set; }
}
我知道這是一個的絆倒我的命名空間,但沒有我嘗試過的作品。有誰知道我需要做什麼?