Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Error Loading XML Document

I occasionally get the error (below).  Once I get the error I can click "Refresh" in the browser and everything is ok.  The error message seems to say that it times out loading the DTD (which is on the same web server).

Is there some problem with XmlDocument.Load() in fetching DTDs?  Ones that are URLs?

The xml document:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE index SYSTEM "http://***removed for anonymity***/DTDs/HrmsIndex.dtd">
<index indexfile="About.xml" />
The error message:

[WebException: The operation has timed-out.]
  System.Net.HttpWebRequest.GetResponse() +205
  System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +65
  System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +94
  System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +55
  System.Xml.Schema.DtdParser.ParseDocTypeDecl() +639
  System.Xml.Schema.DtdParser.Parse() +61
  System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner) +71
  System.Xml.XmlTextReader.ParseTag() +1379
  System.Xml.XmlTextReader.ParseRoot() +234
  System.Xml.XmlTextReader.Read() +127
  System.Xml.XmlValidatingReader.ReadWithCollectTextToken() +146
  System.Xml.XmlValidatingReader.Read() +26
  System.Xml.XmlLoader.LoadCurrentNode() +157
  System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49
  System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102
  System.Xml.XmlDocument.Load(XmlReader reader) +72
  System.Xml.XmlDocument.Load(String filename) +78
  Hrms.HrmsXform.serveIndex(String relativeResourcePath, String menuFileName) in \\***removed for anonymity***\hrmsxform.aspx.cs:129
  Hrms.HrmsXform.Page_Load(Object sender, EventArgs e) in \\***removed for anonymity***\hrmsxform.aspx.cs:42
  System.Web.UI.Control.OnLoad(EventArgs e) +67
  System.Web.UI.Control.LoadRecursive() +35
  System.Web.UI.Page.ProcessRequestMain() +731

Thursday, April 29, 2004

"Is there some problem with XmlDocument.Load() in fetching DTDs? "

Not that I'm aware -- I think your error suggests that the web server serving the DTD is perhaps unreliable? Maybe copy the DTD locally and change the reference?

Duncan Smart
Friday, April 30, 2004

I agree, try with all the files residing locally on your computer and then see what happens.

Manish Jadhav

Manish Jadhav
Saturday, May 15, 2004

Haven't seen your code so this could be stating something you already know but...

If you're calling XmlDocument.Load() you have to tell it not to be asynchronous (XmlDocument.Async = false) first. Otherwise subsiquent calls on the XmlDocument may happen before the document is fully loaded.

Monday, May 17, 2004

*  Recent Topics

*  Fog Creek Home