Wednesday, August 08, 2007

System.Net.WebException from XmlDocument.Load

I had a really bizzare problem today - I was loading a local XML document via XmlDocument.Load and it was throwing a System.Net.WebException - The remote server returned an error: (503) Server Unavailable.

I was totally stumped, and then I hapened to open the XML document in question (it's actually an XHTML document), and I noticed that the first line was a DOCTYPE with a link to an external DTD.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Sure enough, following the
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd link gave me a 503 Server Unavailable error!

To resolve the problem I simply removed the DOCTYPE from the HTML document.

1 comment:

Kale Co Jakim said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.