title: Write to, and read binary data from XML file in .Net 2.0
body: <p>I've ready many posts (such as <a href="https://stackoverflow.com/a/3400927/725913">this</a> one) on SO now which explain how to write binary data to an XML using the XMLWriter.WriteBase64 method. However, I've yet to see one which explains how to then read the base64'd data. Is there another built in method? I'm also having a hard time finding solid documentation on the subject. </p>
  
  <p><strong>Here is the XML file that I'm using:</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;pstartdata&gt;
    &lt;pdata&gt;some data here&lt;/pdata&gt;
    emRyWVZMdFlRR0FFQUNoYUwzK2dRUGlBS1ZDTXdIREF ..... and much, much more.
  &lt;/pstartdata&gt;
  </code></pre>
  
  <p><strong>The C# code which creates that file (.Net 4.0):</strong></p>
  
  <pre><code>FileStream fs = new FileStream(Path.GetTempPath() + "file.xml", FileMode.Create);
  
              System.Xml.XmlTextWriter w = new System.Xml.XmlTextWriter(fs, null);
              w.Formatting = System.Xml.Formatting.None;
  
              w.WriteStartDocument();
              w.WriteStartElement("pstartdata");
              #region Main Data
              w.WriteElementString("pdata", "some data here");
  
              // Write the binary data
              w.WriteBase64(fileData[1], 0, fileData[1].Length);
              #endregion (End) Main Data (End)
  
              w.WriteEndDocument();
              w.Flush();
              fs.Close();
  </code></pre>
  
  <p><strong>Now, for the real challenge...</strong>
  Alright, so as you all can see the above was written in .Net 4.0. Unfortunately, the XML file needs to be read by an application using .Net 2.0. Reading in the binary (base 64) data has proven to be quite the challenge.</p>
  
  <h2>Code to read in XML data (.Net 2.0):</h2>
  
  <pre><code>System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
  
              xDoc.LoadXml(xml_data);
  
              foreach (System.Xml.XmlNode node in xDoc.SelectNodes("pstartdata"))
              {
                  foreach (System.Xml.XmlNode child in node.ChildNodes)
                  {
                      MessageBox.Show(child.InnerXml);
                  }
              }
  </code></pre>
  
  <p><strong>What would I need to add in order to read in the base 64'd data (shown above)?</strong></p>