Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# convert xml to list string

/// <summary>
        /// Convert xml to List
        /// </summary>
        /// <param name="xmlFilePath">XML FilePath</param>
        /// <returns>List of String</returns>
        public static List<string> ExtractXMLToList(string xmlFilePath)
        {
            var colHeaders = new List<string>();
            XmlDocument document = new XmlDocument();
            document.Load(xmlFilePath);

            foreach (XmlNode node in document.DocumentElement.ChildNodes)
            {
              
              	//hardcoded xml child node here = MappingData
              	//and attributes of TableField
                if (node.LocalName == "MappingData")
                {
                    var fieldName = node.Attributes["TableField"].Value;
                    colHeaders.Add(fieldName);
                }
            }

            return colHeaders;
        }

//This the sample xml
//<?xml version="1.0" standalone="yes"?>
//<root>
//      <MappingData TableField ="Order Received Date"/>
//</root>
Comment

PREVIOUS NEXT
Code Example
Csharp :: declare prop array c# 
Csharp :: unity play animation on click 
Csharp :: c# check if character is lowercase 
Csharp :: strinng.indexOf c# 
Csharp :: create stripe subscription pay_immediately 
Csharp :: How to execute script in C# 
Csharp :: set background from C# wpf 
Csharp :: serialize object to json 
Csharp :: ascii code c# char 
Csharp :: c# C# read text from a certain line number from string 
Csharp :: quaternion to euler 
Csharp :: add one to one relationship entity framework 
Csharp :: math.pow in C# using loop 
Csharp :: string.format() c# 
Csharp :: action c# 
Csharp :: add rotation 
Csharp :: ioptions mock c# unittest 
Csharp :: Unity Input Key Message 
Csharp :: c# bool? to bool 
Csharp :: How do I identify the referrer page in ASP.NET? 
Csharp :: Unity Scene Load by BuildIndex 
Csharp :: clear highlight winforms treeview 
Csharp :: how to assign 2d physics material through script 
Csharp :: c# get innermost exception 
Csharp :: index sort 
Csharp :: overloading constructors c# 
Csharp :: how to show messagebox 
Csharp :: c# convert address to int 
Csharp :: how to write a ello world program in c# 
Csharp :: C# if (if-then) Statement 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =