0

This is my xml:

<?xml version="1.0"?>

<MDS_FOLD MSG="1" DATE="2010-05-14T20:34:46.050" DESC="RANDOMDESC" NUM="667">

I need to extract date value & num value

I tried this but doesn't work and returns to me null.

using System.Xml.Linq;
var rootElement = XElement.Parse(content);


var num = rootElement.Element("NUM").Value.ToString();
var date = rootElement.Element("DATE").Value.ToString();

1 Answers1

0

I solved it, i could use .Attribute instead of .Element like this:

var num = rootElement.Attribute("NUM").Value.ToString();
var date = rootElement.Attribute("DATE").Value.ToString();