title: How to split an xml file in vb
body: <p>I'm new with dealing with xml files and I'm wondering how would i go about splitting an xml file into two files using vb.</p>
  
  <p>The main issue I'm having with the xml file is that its too large to upload. I'm hoping splitting it into two will solve my issue. For example an xml with a file size of 34kb when split into two will give 2 xml files of 17KB each. </p>
  
  <pre><code>   Dim doc As XDocument 
     doc = XDocument.Load("XMLSplit/Directory.xml")
     ' 1 grab the file size 
     ' 2 divide file size by 2 
     ' 3 find half way of the xml file 
     ' 4 split into two 
     ' 5 save split files as Directory1xml and Directory2.xml
  </code></pre>
  
  <p>Directory.xml </p>
  
  <pre><code>&lt;Directory&gt;
    &lt;Person&gt;
      &lt;Name&gt; John / &lt;/Name&gt;
      &lt;age&gt; 24 &lt;/age&gt;
      &lt;DOB&gt;
        &lt;year&gt; 1990 &lt;/year&gt;
        &lt;month&gt; 03 &lt;/month&gt;
        &lt;date&gt; 23 &lt;/date&gt;
      &lt;/DOB&gt;
    &lt;/Person&gt;
    &lt;Person&gt;
      &lt;Name&gt; Jane / &lt;/Name&gt;
      &lt;age&gt; 21 &lt;/age&gt;
      &lt;DOB&gt;
        &lt;year&gt; 1993 &lt;/year&gt;
        &lt;month&gt; 04 &lt;/month&gt;
        &lt;date&gt; 25 &lt;/date&gt;
      &lt;/DOB&gt;
    &lt;/Person&gt;
  &lt;/Directory&gt;
  </code></pre>