I have an XML document provided to me externally that I need to import into my application. The document is badly written, but not something I can really do much about.
<?xml version="1.0" encoding="iso-8859-1"?>
<xml>
    <Items>
        <Property1 />
        <Property2 />
        ...
    </Items>
    <Items>
        <Property1 />
        <Property2 />
        ...
    </Items>
    ...
</xml>
How should I go about using the XmlSerializer for this?
It doesn't seem to matter what class setup I use, or wether I put XmlRoot(ElementName="xml") on my base class it always says that the <xml xmlns=''> is unexpected.
Edit: Added the C# code I am using
[XmlRoot(ElementName = "xml")]
public class Container
{
    public List<Items> Items { get; set; }
}
public class Items
{
    public short S1 { get; set; }
    public short S2 { get; set; }
    public short S3 { get; set; }
    public short S4 { get; set; }
    public short S5 { get; set; }
    public short S6 { get; set; }
    public short S7 { get; set; }
}
public class XMLImport
{
    public Container Data{ get; private set; }
    public static XMLImport DeSerializeFromFile(string fileName)
    {
        XMLImport import = new XMLImport();
        XmlSerializer serializer = new XmlSerializer(typeof(Container));
        using (StreamReader reader = new StreamReader(fileName))
            import.Data = (Container)serializer.Deserialize(reader);
        return import;
    }
}
 
     
     
     
    
` under `` and add all the `` in this node. since you are serializing it, hopefully it would be you who has to de-serialize it.  
– Tauseef Oct 08 '13 at 06:27