title: XML Deserialization C# gives error for valid document
body: <p>I have a lot of XML files with the same structure. Many of them working OK, but for some XmlSerializer gives me an error but when I put the document in xml validator - it says that document is correct.</p>
  
  <p>Deserialization code:</p>
  
  <pre><code>var document = serializer.Deserialize(File.OpenRead(file));
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>System.InvalidOperationException: There is an error in XML document (504, 8). ---&gt; System.Xml.XmlException: Unexpected node type Element. ReadElementString method can only be called on elements with simple or empty content. Line 504, position 8.
    at System.Xml.XmlReader.ReadElementString()
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPatentdocument.Read33_Claimtext(Boolean isNullable, Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPatentdocument.Read34_Claim(Boolean isNullable, Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPatentdocument.Read35_Claims(Boolean isNullable, Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPatentdocument.Read43_Patentdocument(Boolean isNullable, Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPatentdocument.Read44_patentdocument()
    --- End of inner exception stack trace ---
    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
    at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
  </code></pre>
  
  <p>The part of the document where it gives the error:</p>
  
  <pre><code>&lt;text&gt;12. Führungsschiene nach einem der Ansprüche 2 bis 11, dadurch gekennzeichnet, daß in den beiden Nutwänden (&lt;b&gt;11&lt;i&gt;a&lt;/i&gt;, 11&lt;/b&gt;&lt;i&gt;a′)&lt;/i&gt; einander gegenüberliegende Bohrungen (&lt;b&gt;14&lt;/b&gt;&lt;i&gt;a&lt;/i&gt;, &lt;b&gt;14&lt;/b&gt;&lt;i&gt;a&lt;/i&gt;′) vorgesehen sind, von denen die eine Bohrung (&lt;b&gt;14&lt;/b&gt;&lt;i&gt;a&lt;/i&gt;′) durch das Einsatzteil (&lt;b&gt;15&lt;/b&gt;&lt;i&gt;a)&lt;/i&gt; ver­schlossen ist.&lt;/text&gt;
  </code></pre>
  
  <p>I suppose it is because of inline html tags inside because it complains about this line on position of <strong>i</strong> tag</p>
  
  <pre><code>&lt;b&gt;11&lt;i&gt;a&lt;/i&gt;, 11&lt;/b&gt;
  </code></pre>
  
  <p>But for example this xml is correct according to XmlSerializer and it is possible to deserialize it:</p>
  
  <pre><code>&lt;text&gt;9. Führungsschiene nach Anspruch 8, dadurch gekennzeichnet, daß der Ansatz (&lt;b&gt;20&lt;/b&gt;) die Zuführfläche (&lt;b&gt;25&lt;/b&gt;) aufweist.&lt;/text&gt;
  </code></pre>
  
  <p>So my question why xml validator says that the document is valid and XmlSerializer cannot deserialize it? Is it possible to have a workaround without changing the document?</p>