Ok, here's the fix for me. I was getting the same (2,2) and "was not expected" set of errors.
The section of my XML that was a problem looks like this:
- <ns2:Info xmlns:ns2="http://www.something.org/whatsit-0-3-4">
This is the significant part of the code that xsd.exe generated for me:
ORIGINAL:
- [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.something.org/whatsit-0-3-4")]
-
[System.Xml.Serialization.XmlRootAttribute("Some_Namespace", Namespace = "http://www.different.org/blah-1-3-2", IsNullable = false)]
FIXED & WORKING:
- [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.something.org/whatsit-0-3-4")]
-
[System.Xml.Serialization.XmlRootAttribute("Info", Namespace = "http://www.something.org/whatsit-0-3-4", IsNullable = false)]
The problem for me was that the namespace was the root attribute in the feed I was getting, but the root was listed as a different namespace! Once I changed that and recompiled, it was able to deserialize, because it could now understand what it was looking at.
Hope this helps!