2009-11-23 17 views
3

Je valide un document avec la DTD dans le document qui n'est pas sur ma machine, il est stocké sur internet.Validation avec DTD - connexion forcée

Je reçois actuellement l'exception suivante

System.Xml.XmlException: An error has occurred while opening external DTD 'http://xml.cxml.org/schemas/cXML/1.2.020/cXML.dtd': Unable to connect to the remote server ---> 
System.Net.WebException: Unable to connect to the remote server ---> 
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 216.109.104.11:80
 
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
 
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
 at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
 --- End of inner exception stack trace ---
 
at System.Net.HttpWebRequest.GetResponse()
 
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
 
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
 
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
 
at System.Xml.XmlTextReaderImpl.OpenStream(Uri uri)
 
at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId)
 --- End of inner exception stack trace ---
 
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
 
at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId)
 
at System.Xml.XmlTextReaderImpl.DtdParserProxy.System.Xml.IDtdParserAdapter.PushExternalSubset(String systemId, String publicId)
 
at System.Xml.DtdParser.ParseExternalSubset()
 
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)
 
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)
 
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
 
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
 
at System.Xml.XmlTextReaderImpl.Read()
 
at System.Xml.XmlValidatingReaderImpl.Read()
 
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
 
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
 
at System.Xml.XmlDocument.Load(XmlReader reader)
 
at cXML.ResponseFactory..ctor(HttpRequest request) :: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 216.109.104.11:80
 
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
 
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
 at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
 --- End of inner exception stack trace ---
 
at System.Net.HttpWebRequest.GetResponse()
 
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
 
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
 at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
 
at System.Xml.XmlTextReaderImpl.OpenStream(Uri uri)
 
at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId) :: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 216.109.104.11:80
 
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
 
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
 
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) 

Je sais que le fichier est accessible que je peux parcourir à elle. Mais pourquoi ne peut-il pas y accéder? Merci d'avance.

Répondre

2

J'ai obtenu l'exception suivante lorsque je parcours le fichier dtd [http://xml.cxml.org/schemas/cXML/1.2.020/cXML.dtd].

XML Parsing Error: erreur de syntaxe Emplacement: http://xml.cxml.org/schemas/cXML/1.2.020/cXML.dtd Numéro de ligne 15, colonne 1:

Il suffit de télécharger le fichier dtd et essayez d'accéder au dtd localement. Vous pouvez affiner votre problème.

+0

C'est ce que j'ai fait à la fin. J'ai créé un résolveur et je lui ai juste dit d'utiliser une copie locale. – tgandrews

+0

cela fonctionne-t-il? – nayakam

+0

Ouais, ça marche mais pas rapidement – tgandrews