0
我有一些HTML代碼存儲到一個字符串變量,從HttpWebRequest
導致:刪除HTML節點
<html>
<head>
<div>Lots of scripts and libraries</div>
</head>
<body>
<div>Some very useful data</div>
</body>
<footer>
<div>Not interesting struff</div>
</footer>
<html>
我該怎麼做才能消除所有unecesary節點,進入這樣的:
<body>
<div>Some very useful data</div>
</body>
我會添加「最好」以及「最簡單」的方式。用手解析html比看起來更難。 – dman2306
偉大的解決方案!現在我有我想要的東西。另外,這個快速教程補充了Robert的回答:http://www.w3schools.com/xsl/xpath_syntax.asp –