I have following xml file:
<os:tax>
<os:cat name="abc" id="1">
<os:subcat name="bcd" id="11">
<os:t name="def" id="111">
<os:cut name="hello" id="161" cutURL="/abc/a.html"/>
<os:cut name="hello2" id="162" cutURL="/abc1/a1.html"/>
<os:cut name="hello3" id="163" cutURL="/abc4/a3.html"/>
</os:t>
</os:subcat>
</os:cat>
<os:cat name="def" id="2">
<os:subcat name="bcd" id="22">
<os:t name="def" id="222">
<os:cut name="hello" id="171" cutURL="/abcs/a.html"/>
<os:cut name="hello2" id="172" cutURL="/abcs1/a1.html"/>
<os:cut name="hello3" id="173" cutURL="/abcs4/a3.html"/>
</os:t>
</os:subcat>
</os:cat>
</os:tax>
it has more os:cat under it. Just showing two here for ease of use. I have table like this in oracle:
ID os_lev title parent_id cut_url
1 cat abc null null
11 subcat bcd 1 null
111
161
162
163
2
22
...
I want to fill up this table like this. I want to know what is the best way to do this with console app in c#? I am doing is:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:\\getxml.xml");
XmlNodeList tax= xmlDoc.GetElementsByTagName("os:tax");
foreach (XmlNode node in tax)
{
//here i will save all the nodes? What is the best way to do this?
//Also should i do a insert in oracle right here?
}
Should this foreach be inside try loop?