我正在尝试使用带有 Datacontract 类的 Atom 提要强制转换 XML,但我失败了......
我的代码如下:
Content.ReadAsAsync<ArticleDTOs>()
[Serializable]
[DataContract(Namespace = "urn:schemas-something:some", Name = "document")]
public class ArticleDTOs
{
[DataMember(Name = "entry")]
public entry entry { get; set; }
}
[Serializable]
[DataContract(Namespace ="http://www.w3.org/2005/Atom")]
public class entry
{
[DataMember(Name = "id")]
public string id { get; set; }
}
}
我感觉问题与命名空间声明有关
datacontract....我应该如何设置命名空间以正确读取 XML 命名空间???
这是我必须反序列化的 XML
<?xml version="1.0" encoding="utf-8"?>
<document id="m.fy7c2fsvzxtv" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="urn:schemas-something:some">
<atom:entry><atom:id>m.fy7c2fsvzxtv</atom:id><atom:title>test title</atom:title><atom:published>2013-07-08T17:21:06.4035574+01:00</atom:published><atom:updated>2013-07-08T17:21:06.4050577+01:00</atom:updated><subheadline>test sub headline</subheadline><standfirst>desc</standfirst><keywords>keywords</keywords>
<atom:content>body with Encoding </atom:content></atom:entry></document>