I'm loading valid XHTML into an XmlDocument, but it takes 2 seconds to load. I've found that if I drop the DTD, it's instant, but then I have to replace to  , etc. The number of declared HTML entities is large, so I feel the DTD should be loaded. So what is the easiest way to pre-load the DTD with minimal manual labor? Perhaps if I could, say, put the DTD into the assembly as a resource file and inject it in..? Any suggestions?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Should I use static function in c# where many call
I found a technique here, by implementing the abstract class XmlResolver and setting it to the XmlDocument's XmlResolver property. The abstract class implementation returns a MemoryStream object for the URL being requested, which contains the DTD or whatever other resource would normally be loaded over HTTP.
http://www.codeproject.com/KB/XML/HTML2XHTML.aspx?display=Print