I have a xml data like this
string data = @"<DeliveryReport><message id=""093102403501103726""
sentdate=""2013/10/24 08:50:11"" donedate=""2013/10/24 08:50:12""
status=""NOT_DELIVERED"" gsmerror=""1"" /></DeliveryReport>";
and am converting/parsing it like
if (data != null)
{
XDocument xmlDoc = XDocument.Load(data);
var tutorials = from tutorial in xmlDoc.Descendants("message")
select new
{
};
}
is is throwing error Illegal characters in path. can any body tell me what i m misisng?
You're using XDocument.Load(string)
, which accepts a filename or URL to load the XML from:
Parameters
uri: A URI string that references the file to load into a new XDocument.
You want XDocument.Parse(string)
, which accepts XML already in a string:
Parameters
text: A string that contains XML.
See more on this question at Stackoverflow