2010-12-18 47 views
0

我想知道內部使用何種調用xmldocument來加載XML,它是否會產生httpwebsrequest或其他任何內容。XMLdocument.load(url)內部是否會從其他位置加載XML

我讀到這裏,但對內部

http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.load.aspx

XmlDocument doc = new XmlDocument(); 

doc.Load("http://someotherserver/test.xml"); 

誰能告訴我這個沒有足夠的信息。

+0

您可以使用.NET反射看到自己http://www.red-gate.com/products/dotnet-development/reflector/ – Vadim 2010-12-18 05:34:24

+0

@我必須下載這個,它不允許在我的辦公室筆記本電腦上使用,你能告訴我,如果你知道的話 – kobe 2010-12-18 05:37:19

回答

4

我覺得這是做它的代碼。

它在XmlDownloadManager類,這是內部

private Stream GetNonFileStream(Uri uri, ICredentials credentials) 
{ 
    WebRequest request = WebRequest.Create(uri); 
    if (credentials != null) 
    { 
     request.Credentials = credentials; 
    } 
    WebResponse response = request.GetResponse(); 
    HttpWebRequest request2 = request as HttpWebRequest; 
    if (request2 != null) 
    { 
     lock (this) 
     { 
      if (this.connections == null) 
      { 
       this.connections = new Hashtable(); 
      } 
      OpenedHost host = (OpenedHost) this.connections[request2.Address.Host]; 
      if (host == null) 
      { 
       host = new OpenedHost(); 
      } 
      if (host.nonCachedConnectionsCount < (request2.ServicePoint.ConnectionLimit - 1)) 
      { 
       if (host.nonCachedConnectionsCount == 0) 
       { 
        this.connections.Add(request2.Address.Host, host); 
       } 
       host.nonCachedConnectionsCount++; 
       return new XmlRegisteredNonCachedStream(response.GetResponseStream(), this, request2.Address.Host); 
      } 
      return new XmlCachedStream(response.ResponseUri, response.GetResponseStream()); 
     } 
    } 
    return response.GetResponseStream(); 
} 
+0

謝謝,讓我通過代碼 – kobe 2010-12-18 05:48:22