It appears that you have JavaScript disabled. Click here to find out what you're missing on this site.

The Site Formerly Known as Bit Working This site has moved to http://bitworking.org

by Joe Gregorio
::: Friday, June 21, 2002

System.Xml.XmlDocument and DTD's

In .NET it turns out that if you load an XML document into XmlDocument, i.e.

   XmlDocument doc = new XmlDocument();
   doc.Load("test.html");
then all of the DTD's are pulled in and parsed, even if you do not pass the XmlDocument to a validating reader. If it can't find the DTD's then it throws an exception. Not the behaviour I expected. The way to stop this isn't obvious at first either, but this works:
   XmlDocument doc = new XmlDocument();
   doc.XmlResolver = null;
   doc.Load("test.html");
The reason I know this is because I was trying to load an XHTML 1.1 document into XmlDocument and it kept failing. It appears that the XmlResolver can't handle relative path names for included DTD's, and guess what, the official DTD for XHTML 1.1 loads other DTD's and does so with a relative URL in some cases. You will have to wait a while to find out why I was trying to load an XHTML document into XmlDocument...

11:52:49 PM  #  

If you are interested in how Aggie works, I have posted a short Theory Of Operation for Aggie.

11:32:53 PM  #  

I am soooo jealous

It seems like every day I run into one more reason to move to Italy. Recently it was this wired article, and now Ben Hammersley is moving there.

9:50:43 PM  #