为什么 System.Xml.XmlDocument.LoadXml
法掷 System.Net.WebException
?
这真的是让人难以置信的疯狂,如果 MSDN 是正确的, loadXML的
应该顶多给我一个 System.Xml.XmlException
。
不过,我有奇怪的例外,如:
基础连接已关闭:连接被意外关闭
昏暗的文件作为新的XmlDocument
document.LoadXml(< DOCTYPE HTML PUBLIC! - // W3C // DTD XHTML 1.0过渡// ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional。 DTD>&其中X - GT;&所述; / X>中)
MSGBOX(document.LastChild.Name)
这到底是怎么造成的例外呢?
解决方案埃德温给你的解决方案,我现在给你的连接中断的原因:
http://www.w3.org/blog/systeam / 2008/02/08 / w3c_s_excessive_dtd_traffic /
Why does System.Xml.XmlDocument.LoadXml
method throw System.Net.WebException
?
This is really mind boggling crazy, if MSDN was right, LoadXml
should at most give me a System.Xml.XmlException
.
Yet I have weird exceptions like:
The underlying connection was closed: The connection was closed unexpectedly.
Dim document As New XmlDocument
document.LoadXml("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""><x></x>")
MsgBox(document.LastChild.Name)
What on earth is causing the exception ?
解决方案Edwin gave you the solution, and I'm giving you the reason for the connection drop:
http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic/