EDN Admin
Well-known member
Hi, Im having problems with entities and LoadXml:
XmlException: Reference to undeclared entity nbsp. Line 1, position 5.
Code:
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
class Program
{
static void Main(string[] args)
{
string xml = "<r> </r>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
}
}
Adding the following does not solve it:
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
doc.XmlResolver = null;
Ive also tried using a StringReader and passing that in to an XmlReader and same issue. Ive also tried creating my own XmlResolver, but it never gets called, even if I set it on the XmlReader. Ive also tried creating my own XmlReader and overriding CanResolveEntity to return false, but that does not work.
Ive run out of ideas, anyone know why this is occuring?
Thanks!
Kevin
View the full article
XmlException: Reference to undeclared entity nbsp. Line 1, position 5.
Code:
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
class Program
{
static void Main(string[] args)
{
string xml = "<r> </r>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
}
}
Adding the following does not solve it:
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
doc.XmlResolver = null;
Ive also tried using a StringReader and passing that in to an XmlReader and same issue. Ive also tried creating my own XmlResolver, but it never gets called, even if I set it on the XmlReader. Ive also tried creating my own XmlReader and overriding CanResolveEntity to return false, but that does not work.
Ive run out of ideas, anyone know why this is occuring?
Thanks!
Kevin
View the full article