Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your deserialization code could look something like this:</p> <pre><code> XmlSerializer sz = new XmlSerializer(typeof(booksType)); var reader = new XmlNodeReader(booksXmlNode); var books = sz.Deserialize(reader); </code></pre> <p>[EDIT] This is better, because the namespace declarations are preserved with the XmlNode, whereas converting to an XML string via OuterXml appears to slice off the namespace declaration for the ns1 prefix, and the serializer then barfs on the type attribute value containing this prefix. I imagine this is a bug in the XML implementation but maybe an XML guru can confirm this.</p> <p>This should get you past the error you are seeing, but whether it solves the problem completely I'm not sure.</p> <p>[FURTHER EDIT] As noted in the comments below, there is a bug in the .NET XmlSerializer which is causing the deserialization to fail. Stepping through the deserialization code in the generated assembly, there is a point where the following condition is tested:</p> <pre><code>(object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_namespace)) </code></pre> <p>Although the <code>Namespace</code> property of the <code>XmlQualifiedName</code> has the same value ('namespace') as the string variable <code>id2_namespace</code>, the condition is evaluating to false because it is coded as an object identity test rather than a test for string value equivalence. Failing this condition leads directly to the exception reported by OP. </p> <p>As far as I can see, this bug will always cause deserialization to fail whenever the XML for the object being deserialized uses one prefix on the object's root element name, and another prefix (defined as the same namespace) on that element's xsi:type attribute.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload