I have an XML file from which I have to extract some specific nodes and put them in a SQL table.
I am using XmlReader and have switch case on XmlReader.Name
Here is just a sample one with very few nodes just for explanation.
<products>
<product>
<description>Nothing</description>
<cost>$34.78</cost>
<inventory>166</inventory>
</product>
<product>
<description>Nike Cap 17893</description>
<cost>$29.99</cost>
<inventory>54</inventory>
</product>
</products>
The idea is if there is Nothing in description node, I should ignore the entire product and move to the next product.
I wanted to use XmlReader.Skip() in that case but it seems it only skips the chidren nodes but the parents nodes.
Just wondering if C# provides any method to ignore parent node?
XDocument doc = XDocument.Load("products.xml")