re-writing large XML Files - excluding certain node
<p>I would like to re-write a large xml without some of its nodes.
I'm trying to read an XML file (100s of MBs, can't read it all to memory) line by line using system.xml.xmlreader - struggling to find a way to read parts of it, write them down to a separate xDocument and then save that xDocument to the disk.</p>

<p>What i've been thinking is something like:</p>

<pre><code>      using (XmlReader reader = XmlReader.Create(_xml_path))
        {
            using (XmlWriter writer = XmlWriter.Create(@"filteredxml.xml"))
            {
                reader.MoveToContent();

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name != "EL_TO_BE_REMOVED")
                        {
                           //writer.WriteNode(reader.ReadOuterXml());

                        }
                    }
                }
            }
        }
</code></pre>

<p>but reader.ReadOuterXml() simply goes to the first element and writes all its descendants to a file, without letting me filter for elements I wish to ignore.</p>