views:

112

answers:

1

I have 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>

I want to deserialize it to object, for example:

[Serializable()]
[XmlRoot(Namespace = "wnio")]
public class Dokument
{ ... }

What parameter should XmlSerializer constructor has?

XmlSerializer serializer = new XmlSerializer(typeof(Dokument), 'What here?' );

XmlSerializer.Deserialize complains that it did not expect element http://crd.gov.pl/wzor/2009/03/31/119/'>. Why is that?

A: 

wnio is just an alias. Try this:

[Serializable()]
[XmlRoot(Namespace = "http://crd.gov.pl/wzor/2009/03/31/119/")]
public class Dokument
{ ... }
Jonathan