我有一个如下所示的 xml
string input =
@"<g1:Person xmlns:g1=""http://api.google.com/staticInfo/"">
<g1:Id>005008</g1:Id>
<g1:Infolist>
<g1:Info><g1:Title>a</g1:Title></g1:Info>
<g1:Info<g1:Title>b</g1:Title></g1:Info>
<g1:Info><g1:Title>c</g1:Title></g1:Info>
<g1:overview>there are three chaters.</g1:overview>
</g1:Infolist>
<g1:age>23</g1:age>
</g1:Person>";
我定义了对象,但我不知道将 /Person/Infolist/overview 放在哪里。这个属性如何定义。放在哪里。
[XmlRoot(ElementName = "Person", Namespace = "http://api.google.com/staticInfo/")]
public class Person
{
public int Id { get; set; }
public int age { get; set; }
[XmlElement(ElementName = "Infolist", Namespace = "http://api.google.com/staticInfo/")]
public List<Info> Infolist {get;set; }
}
public class Info
{
public int Title { get; set; }
}