HTML 파싱을 보다 쉽게 할수있게 해주는 무료프레임워크
예제
BODY 태그의 내용만 가져오기
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(q); //<html><body>kojaedoo</body></html> HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body"); if (bodyNode != null) { // Do something with bodyNode var bodyContent = bodyNode.InnerHtml; }
다른예제
HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { HtmlAttribute att = link["href"]; att.Value = FixLink(att); } doc.Save("file.htm");
다운로드
'C# 상용 컨트롤' 카테고리의 다른 글
FlexGrid CheckBox 로 선택된 항목 가져오기 (0) | 2013.03.29 |
---|---|
[ ComponentOne ] Sample Explorer 실행안될때 (0) | 2013.03.11 |
[ C1FlexGrid ] DataMap 정렬문제 처리방법 (0) | 2013.03.07 |