Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:03:10+00:00 2026-05-19T15:03:10+00:00

I am building a custom XML document. The following code takes upwards of 30

  • 0

I am building a custom XML document.

The following code takes upwards of 30 seconds to execute (see comments) Why?

var doc = new XmlDocument(); 
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));

// hangs on next line - doc.CreateDocumentType()
var xmlDocType = doc.CreateDocumentType(
            "svg"
            , "-//W3C//DTD SVG 20001102//EN"
            , "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd"
            , null);

doc.AppendChild(xmlDocType);

When this takes over 30 seconds, I get the following exception:

System.Net.WebException:

"The underlying connection was closed: The connection was closed unexpectedly."

Exception Stack Trace:

at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenAndPush(Uri uri)
at System.Xml.XmlTextReaderImpl.PushExternalEntityOrSubset(String publicId, String systemId, String 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:03:11+00:00Added an answer on May 19, 2026 at 3:03 pm

    Probably because your resolver is trying to fetch the specified DTD from http://www.w3.org.

    They’re not serving up the DTDs directly any more due to heavy traffic (see this link for info).

    You need to download the DTDs from their W3C web site, cache them locally and have your resolver map the specified URL to your locally cached copy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a custom structured editor for an XML document in Flex. What
I'm trying to implement the following code in a html document: $(function () {
I have read several documentations about building custom ErrorHandler (by inheriting from IErrorHandler). Unfortunately,
I asked a question about building custom Thread Safe Generic List now I am
I am building a custom win32 control/widget and would like to change the cursor
I'm building some custom tools to work against a JIRA install, and the exposed
I'm building a custom web part for SharePoint and I'm trying to use the
I'm building a custom Ubuntu kernel and have modified one of the source files.
I'm building a custom UITableView with each of the cells containing a piece of
I'm building a custom RTE that converts user input to a homebrewn markup, now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.