I have difficulties to read from that xml! I think XMLDocument
would help but i don't know how to get value from each element in childNode!
Especially, the childnode which has any childNode Inside like IdList.
XML format :
<sdnEntry>
<programList>
<program>SDNT</program>
</programList>
<idList>
<id>
<uid>6028</uid>
<idType>NIT #</idType>
<idNumber>900106267-0</idNumber>
<idCountry>Colombia</idCountry>
</id>
<id>
<uid>6029</uid>
<idType>N0T #</idType>
<idNumber>900106267-1</idNumber>
<idCountry>Colombian</idCountry>
</id>
</idList>
</sdnEntry>
Code :
XmlDocument doc = new XmlDocument();
doc.Load(@"D:\SDN1.xml");
XmlElement root = doc.DocumentElement;
XmlNodeList sdnEntryNodeList = root.GetElementsByTagName("sdnEntry");
foreach (XmlNode sdnNode in sdnEntryNodeList)
{
for (int row = 0; row < sdnEntryNodeList.Count; row++)
{
XmlNodeList programListNodeList = sdnNode["programList"].GetElementsByTagName("program");
foreach (XmlNode programNode in programListNodeList)
{
program = programNode.InnerText;
}
XmlNodeList idListNodeList = element["idList"].GetElementsByTagName("id");
foreach (....)
{
}
}
}
The above code , is it good ? otherwise , i will take all your advice, please comment ....
How to read programList and idList in That complex XML ?