我有xml:
<?xml version="1.0" encoding="UTF-8"?>
<wnio:Dokument xmlns:wnio="http://crd.gov.pl/wzor/2009/03/31/119/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... >
</wnio:Dokument>
我想将其反序列化为object,例如:
[Serializable()]
[XmlRoot(Namespace = "wnio")]
public class Dokument
{ ... }
XmlSerializer构造函数应该包含哪些参数?
XmlSerializer serializer = new XmlSerializer(typeof(Dokument), 'What here?' );
XmlSerializer.Deserialize
抱怨说它不期望元素http://crd.gov.pl/wzor/2009/03/31/119/'>
。那是为什么?
答案 0 :(得分:0)
wnio只是一个别名。试试这个:
[Serializable()]
[XmlRoot(Namespace = "http://crd.gov.pl/wzor/2009/03/31/119/")]
public class Dokument
{ ... }