I get the error specified in the title.¨Notice I have used the XmlConvert.IsXmlChar as suggested in other thread however I still get the error.
XDocument GetXDocument(string fileName, CloudBlobDirectory folder)
{
CloudBlockBlob blob = folder.GetBlockBlobReference(fileName);
using (var memoryStream = new MemoryStream())
{
blob.DownloadToStream(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(memoryStream, Encoding.UTF8);
var xml = sr.ReadToEnd();
var validXmlChars = xml.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray();
xml = new string(validXmlChars);
return XDocument.Parse(xml);
}
}
This is the line where it fails:
<Property Name="Printkode" Type="String" Access="ReadWrite" Value="%% d2m*DOKSTART|d2m*OVERSKRIFT:"xx"|d2m*CPR:"xxx"" />