Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 9244

How to read the Corresponding column Value from Sample Data XML file while Data Import?

$
0
0

HI expert, i am trying to read the AccountSampleData.XML of CRM. i am getting all the columns display name and also the rows cell values. but the cell values are not as per the column. for example, if the third column  name is Parent contactId in XML file, the third cell value is MainPhone in XML file. But the MainPhone  Column is 4th Column. How should i read the corresponding correct Column values from the XML File. Here i am doing like below. Please suggest where i am wrong.

 XmlDocument entityDoc = new XmlDocument();            
                String filePath = @"C:\Saroj\Entity\AccountSampleData.xml";                            
                    entityDoc.Load(filePath);
                    colHeadings = new List<string>();
                    attributeSchemaList = new List<string>();                    
         XmlNodeList entityRowlist = entityDoc.GetElementsByTagName("Row");                    
         XmlNodeList entityName = entityDoc.GetElementsByTagName("Worksheet");                    
         string entityName = accountEntName[0].Attributes[0].Value;

                   
for (int row = 0; row < entityRowlist[0].ChildNodes.Count; row++)
{
               colHeadings.Add(entityRowlist[0].ChildNodes[row].FirstChild.InnerText);  // Get the Column Headings
                       
}
 for (int k = 1; k < entityRowlist.Count; k++)
 {
     for (int m = 0; m < entityRowlist[k].ChildNodes.Count; m++)
         {
            Console.WriteLine("The Account Records are : " + entityRowlist[k].ChildNodes[m].InnerText);
          }
  }

Please suggest

Thank you


saroj



Viewing all articles
Browse latest Browse all 9244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>