Loading large XML on DataSet (OutOfMemory Exception)
<p>I am trying to read a 3GB XML file through a URl and store all the jobs in dataset. XML looks like this:</p>

<pre><code>    &lt;?xml version="1.0"?&gt;
    &lt;feed total="1621473"&gt;
      &lt;job&gt;
        &lt;title&gt;&lt;![CDATA[Certified Medical Assistant]]&gt;&lt;/title&gt;
        &lt;date&gt;2016-03-25 14:19:38&lt;/date&gt;
        &lt;referencenumber&gt;2089677765&lt;/referencenumber&gt;
        &lt;url&gt;&lt;![CDATA[http://www.jobs2careers.com/click.php?id=2089677765.1347]]&gt;&lt;/url&gt;
        &lt;company&gt;&lt;![CDATA[Broadway Medical Clinic]]&gt;&lt;/company&gt;
        &lt;city&gt;Portland&lt;/city&gt;
        &lt;state&gt;OR&lt;/state&gt;
        &lt;zip&gt;97213&lt;/zip&gt;
     &lt;/job&gt;
     &lt;job&gt;
        &lt;title&gt;&lt;![CDATA[Certified Medical Assistant]]&gt;&lt;/title&gt;
        &lt;date&gt;2016-03-25 14:19:38&lt;/date&gt;
        &lt;referencenumber&gt;2089677765&lt;/referencenumber&gt;
        &lt;url&gt;&lt;![CDATA[http://www.jobs2careers.com/click.php?id=2089677765.1347]]&gt;&lt;/url&gt;
        &lt;company&gt;&lt;![CDATA[Broadway Medical Clinic]]&gt;&lt;/company&gt;
        &lt;city&gt;Portland&lt;/city&gt;
        &lt;state&gt;OR&lt;/state&gt;
        &lt;zip&gt;97213&lt;/zip&gt;
     &lt;/job&gt;
    &lt;/feed&gt;
</code></pre>

<p>This is my code</p>

<pre><code>XmlDocument doc = new XmlDocument();
            doc.Load(url);
            DataSet ds = new DataSet();
            XmlNodeReader xmlReader = new XmlNodeReader(doc);

            while (xmlReader.ReadToFollowing("job"))
            {
                ds.ReadXml(xmlReader);
            }
</code></pre>

<p>But I got memory out of bound exception. Browsed on google
and found this:</p>

<pre><code>DataSet ds = new DataSet();
        FileStream filestream = File.OpenRead(url);
        BufferedStream buffered = new BufferedStream(filestream);
        ds.ReadXml(buffered);
</code></pre>

<p>still the same exception. I also read about XmlTextReader but i don't know how to make use of it in my case.
I know why i am getting the exception but i don't know how to overcome that.Thanks</p>