[英]Loading HTML fragments asynchronous in a web page that is generated using XSLT & XML
[英]Loading HTML page as XML
我用它來通過XML加載HTML頁面
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(Server.MapPath("index.htm"))
要么
Dim xmldoc As XDocument
xmldoc = XDocument.Load(Server.MapPath("index.htm"))
但是我遇到了一些錯誤,例如:
Expecting an internal subset or the end of the DOCTYPE declaration. Line 2, position 14
Expecting an internal subset or the end of the DOCTYPE declaration. Line 2, position 14
; '>' is an unexpected token. The expected token is '"' or '''. Line 1, position 62
'>' is an unexpected token. The expected token is '"' or '''. Line 1, position 62
; Expecting an internal subset or the end of the DOCTYPE declaration. Line 5, position 20
Expecting an internal subset or the end of the DOCTYPE declaration. Line 5, position 20
。 當我解決一個問題時,所有這些錯誤都出現了,另一個錯誤出現了。
我在問,我是否使用完美的方式來加載此文件,還是有另一種方式?
使用HTML Agility Pack解析HTML文檔。
這是一個解析HTML文件的.NET庫。 該解析器對“真實世界”格式的HTML十分寬容。 對象模型與System.Xml.XmlDocument非常相似,但適用於HTML文檔。 它支持XPath和XSLT。
Dim htmlDoc As New HtmlDocument()
htmlDoc.Load(Server.MapPath("index.htm"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.