title: Hexadecimal value 0x00 is a invalid character loading XML document
body: <p>I recently had an XML which would not load. The error message was</p>
  
  <blockquote>
    <p>Hexadecimal value 0x00 is a invalid character</p>
  </blockquote>
  
  <p>received by the minimum of code in LinqPad (C# statements):</p>
  
  <pre><code>var xmlDocument = new XmlDocument();
  xmlDocument.Load(@"C:\Users\Thomas\AppData\Local\Temp\tmp485D.tmp");
  </code></pre>
  
  <p>I went through the XML with a hex editor but could not find a 0x00 character. I minimized the XML to</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;x&gt;
  &lt;/x&gt;
  </code></pre>
  
  <p>In my hex editor it shows up as</p>
  
  <pre><code>Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  
  00000000  FF FE 3C 00 3F 00 78 00 6D 00 6C 00 20 00 76 00  ÿþ&lt;.?.x.m.l. .v.
  00000010  65 00 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00  e.r.s.i.o.n.=.".
  00000020  31 00 2E 00 30 00 22 00 20 00 65 00 6E 00 63 00  1...0.". .e.n.c.
  00000030  6F 00 64 00 69 00 6E 00 67 00 3D 00 22 00 55 00  o.d.i.n.g.=.".U.
  00000040  54 00 46 00 2D 00 38 00 22 00 3F 00 3E 00 0D 00  T.F.-.8.".?.&gt;...
  00000050  0A 00 3C 00 78 00 3E 00 0D 00 0A 00 3C 00 2F 00  ..&lt;.x.&gt;.....&lt;./.
  00000060  78 00 3E 00                                      x.&gt;.
  </code></pre>
  
  <p>So it's very easy to see that there is no <code>00 00</code> character anywhere. All even columns contain values other than <code>00</code>.</p>
  
  <p>Why does it complain about invalid 0x00 character?</p>