N
Nathan Baker
Hey,
I have an XML file which I am serializing into a class using the
following code:
//
XmlSerializer s = new XmlSerializer(typeof(edition));
StreamReader r = new StreamReader(ConfigFileName);
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ProhibitDtd = false;
xrs.ValidationType = ValidationType.None;
XmlReader xr = XmlReader.Create(r, xrs);
currentEdition = s.Deserialize(xr) as edition;
//
So this works dandy when I'm connected to the Internet. But
unfortunately, the XML file has a dtd in it that points to a remote
site. So when I yank the cat5, I get an error (An error has occurred
while opening external DTD '...: The remote name could not be
resolved)
Obviously, setting 'ProhibitDtd' to true causes an exception as well.
So is there a way to serialize the XML file while ignoring the DTD? I
mean, it's not trying to validate it (ValidationType is None), so why
does it need the DTD? It's just mapping tag names to class names and
attributes to fields. Is there a way to do this, or am I going to have
to cache the DTD locally? -_-
Thanks,
Nathan
I have an XML file which I am serializing into a class using the
following code:
//
XmlSerializer s = new XmlSerializer(typeof(edition));
StreamReader r = new StreamReader(ConfigFileName);
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ProhibitDtd = false;
xrs.ValidationType = ValidationType.None;
XmlReader xr = XmlReader.Create(r, xrs);
currentEdition = s.Deserialize(xr) as edition;
//
So this works dandy when I'm connected to the Internet. But
unfortunately, the XML file has a dtd in it that points to a remote
site. So when I yank the cat5, I get an error (An error has occurred
while opening external DTD '...: The remote name could not be
resolved)
Obviously, setting 'ProhibitDtd' to true causes an exception as well.
So is there a way to serialize the XML file while ignoring the DTD? I
mean, it's not trying to validate it (ValidationType is None), so why
does it need the DTD? It's just mapping tag names to class names and
attributes to fields. Is there a way to do this, or am I going to have
to cache the DTD locally? -_-
Thanks,
Nathan