Vignesh Kumar

Vignesh Kumar

  • NA
  • 1k
  • 415.3k

XML element not displaying for empty values

Nov 16 2015 11:57 PM

Hi,

I am using an xml file to import into the database using the below code.

XmlDocument xmlDoc = new XmlDocument(); 
xmlDoc.Load(path + "Data.xml"); 
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/DocumentElement/Profile"); 
//read XML data and ID is one of the column
object[] ID = XDocument.Load(path + "Data.xml").Descendants("ID").Select(element => Element.Value).ToArray();

Now the ID element has null values and when I read them the rows with null values are omitted. How can I set empty string values for those null nodes?


Answers (4)