I have an object (eg MyObject with namespace eg MyNamespace)
[XmlRoot("MyObject", Namespace="MyNamespace", IsNullable=false)]
public class MyObject
While I serialize it the XML created is
<MyObject xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="MyNamespace">
<MyObjectCollection Name="MyCollection">
<ObjectState>Null</ObjectState>
</MyObjectCollection>
</MyObject>
and this works fine.
While I'm trying to Deselialize it I recieve an error:
System.InvalidOperationException: There is an error in XML document (1,
2). ---> System.InvalidOperationException: <MyObject xmlns='MyNamespace'>
was not expected.
WHY? The same object, the same namespace, everything is the same.
Trying to remove namespace. The same error:
System.InvalidOperationException: There is an error in XML document (1,
2). ---> System.InvalidOperationException: <MyObject xmlns=''> was not
expected.
Strange...
Please advice...
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "