Xml - DTD processing
-
Hello! I am trying to read an XML file that specifies an external DTD source, namely http://www.apple.com/DTDs/PropertyList-1.0.dtd When I execute the reader.MoveToContent() in the code below
System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
settings.ProhibitDtd = false;
using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(uri, settings))
{
reader.MoveToContent();customers sometimes get this exception:
Exception : System.Xml.XmlException
Message : An error has occurred while opening external DTD 'http://
www.apple.com/DTDs/PropertyList-1.0.dtd': Unable to connect to the remote server
Source : System.Xml
Help :
OSVersion : Microsoft Windows NT 5.1.2600 Service Pack 2
Thread :
Stack :
at System.Xml.XmlTextReaderImpl.Throw(Exception e)...
Exception : System.Net.Sockets.SocketException
Message : A socket operation was attempted to an unreachable hostWeird is that the customers have internet access because the XmlReader is created from an uri... but the DTD seem to be not available. Can I somehow deactivate the DTD processing completely? :confused: :mad: Any hints would be greatly appreciated. TIA Pakl
-
Hello! I am trying to read an XML file that specifies an external DTD source, namely http://www.apple.com/DTDs/PropertyList-1.0.dtd When I execute the reader.MoveToContent() in the code below
System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
settings.ProhibitDtd = false;
using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(uri, settings))
{
reader.MoveToContent();customers sometimes get this exception:
Exception : System.Xml.XmlException
Message : An error has occurred while opening external DTD 'http://
www.apple.com/DTDs/PropertyList-1.0.dtd': Unable to connect to the remote server
Source : System.Xml
Help :
OSVersion : Microsoft Windows NT 5.1.2600 Service Pack 2
Thread :
Stack :
at System.Xml.XmlTextReaderImpl.Throw(Exception e)...
Exception : System.Net.Sockets.SocketException
Message : A socket operation was attempted to an unreachable hostWeird is that the customers have internet access because the XmlReader is created from an uri... but the DTD seem to be not available. Can I somehow deactivate the DTD processing completely? :confused: :mad: Any hints would be greatly appreciated. TIA Pakl
is it possible to get a local copy of the dtd and validate against that? It may be that some transient error is causing you a problem. Russ
-
Hello! I am trying to read an XML file that specifies an external DTD source, namely http://www.apple.com/DTDs/PropertyList-1.0.dtd When I execute the reader.MoveToContent() in the code below
System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();
settings.ProhibitDtd = false;
using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(uri, settings))
{
reader.MoveToContent();customers sometimes get this exception:
Exception : System.Xml.XmlException
Message : An error has occurred while opening external DTD 'http://
www.apple.com/DTDs/PropertyList-1.0.dtd': Unable to connect to the remote server
Source : System.Xml
Help :
OSVersion : Microsoft Windows NT 5.1.2600 Service Pack 2
Thread :
Stack :
at System.Xml.XmlTextReaderImpl.Throw(Exception e)...
Exception : System.Net.Sockets.SocketException
Message : A socket operation was attempted to an unreachable hostWeird is that the customers have internet access because the XmlReader is created from an uri... but the DTD seem to be not available. Can I somehow deactivate the DTD processing completely? :confused: :mad: Any hints would be greatly appreciated. TIA Pakl
From MS newsgroup: == XmlReader always checks if DTD exists (to make sure document is wellformed), it doesn't actually parse it. So the solution is to provide to XmlReader custom XmlResolver, which will return something dummy when requested to resolve "http://www.apple.com/DTDs/PropertyList-1.0.dtd". ==