I am trying to read xml string from DB. However my code is erroring?
Here is my code
string strUrl = "<?xml version="1.0" encoding="utf-16"?><boolean>false</boolean>";
XmlTextReader xmlReader = new XmlTextReader(new StringReader(strUrl));
while (xmlReader.Read())
{
switch (xmlReader.NodeType)
{
case XmlNodeType.Element:
break;
case XmlNodeType.Text:
break;
}
}
Where I’m i going wrong?
Your code as is won’t compile, because you use double quotes inside the string. You could try to use single quotes instead:
Alternatively escape the double quotes: