-
-
Save abjerner/35c8d8b2ce16c307cfee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string html = "<img src=\"/media/8301/HD00_498x299.jpg\" width=\"498\" height=\"530\" alt=\"HD00.JPG\" usemap=\"#imgmap201392714219\"/><map name=\"imgmap2012104102243\"\nid=\"imgmap2012104102243\">\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/1\"\nshape=\"rect\" coords=\"194,419,219,439\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/2\"\nshape=\"rect\" coords=\"221,420,246,439\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/3\"\nshape=\"rect\" coords=\"200,302,226,320\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/4\"\nshape=\"rect\" coords=\"209,167,234,185\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/6\"\nshape=\"rect\" coords=\"68,46,98,67\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/7\"\nshape=\"rect\" coords=\"102,203,129,224\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/8\"\nshape=\"rect\" coords=\"273,339,302,360\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/9\"\nshape=\"rect\" coords=\"387,350,417,372\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/10\"\nshape=\"rect\" coords=\"324,341,354,363\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/11\"\nshape=\"rect\" coords=\"223,369,252,390\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/12\"\nshape=\"rect\" coords=\"62,270,89,294\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/13\"\nshape=\"rect\" coords=\"93,270,119,294\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/14\"\nshape=\"rect\" coords=\"31,94,60,114\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/14\"\nshape=\"rect\" coords=\"79,161,106,182\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/15\"\nshape=\"rect\" coords=\"19,150,50,171\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/15\"\nshape=\"rect\" coords=\"82,113,110,134\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/16\"\nshape=\"rect\" coords=\"176,231,205,253\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/17\"\nshape=\"rect\" coords=\"147,179,176,200\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/18\"\nshape=\"rect\" coords=\"139,235,166,257\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/19\"\nshape=\"rect\" coords=\"204,56,231,78\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/20\"\nshape=\"rect\" coords=\"125,135,153,157\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/21\"\nshape=\"rect\" coords=\"265,263,290,284\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/23\"\nshape=\"rect\" coords=\"9,202,36,225\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/24\"\nshape=\"rect\" coords=\"39,202,65,225\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/25\"\nshape=\"rect\" coords=\"158,80,184,101\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/26\"\nshape=\"rect\" coords=\"188,80,213,102\" target=\"_blank\" alt=\"\" />\n</map><map id=\"imgmap201392714219\">\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/1\"\nshape=\"rect\" coords=\"265,463,279,480\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/2\"\nshape=\"rect\" coords=\"282,466,297,480\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/3\"\nshape=\"rect\" coords=\"213,339,237,358\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/4\"\nshape=\"rect\" coords=\"206,204,227,220\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/6\"\nshape=\"rect\" coords=\"113,105,135,121\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/7\"\nshape=\"rect\" coords=\"134,246,154,262\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/8\"\nshape=\"rect\" coords=\"299,369,319,386\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/9\"\nshape=\"rect\" coords=\"432,409,453,425\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/10\"\nshape=\"rect\" coords=\"363,394,385,413\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/11\"\nshape=\"rect\" coords=\"254,406,276,422\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/12\"\nshape=\"rect\" coords=\"105,298,122,314\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/13\"\nshape=\"rect\" coords=\"122,298,139,314\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/14\"\nshape=\"rect\" coords=\"53,121,77,139\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/15\"\nshape=\"rect\" coords=\"49,165,72,182\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/16\"\nshape=\"rect\" coords=\"195,272,214,288\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/17\"\nshape=\"rect\" coords=\"152,212,175,230\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/18\"\nshape=\"rect\" coords=\"160,276,180,293\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/19\"\nshape=\"rect\" coords=\"234,88,255,105\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/20\"\nshape=\"rect\" coords=\"132,155,158,174\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/21\"\nshape=\"rect\" coords=\"299,294,321,311\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/23\"\nshape=\"rect\" coords=\"40,234,55,250\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/24\"\nshape=\"rect\" coords=\"56,233,73,251\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/25\"\nshape=\"rect\" coords=\"185,108,202,127\" target=\"_blank\" alt=\"\" />\n<area title=\"\" href=\"/nl/producten/hellend-dak/unidek-aero/26\"\nshape=\"rect\" coords=\"203,109,219,127\" target=\"_blank\" alt=\"\" />\n</map>"; | |
HtmlDocument doc = new HtmlDocument(); | |
doc.LoadHtml(html); | |
var oldHtml = doc.DocumentNode.InnerHtml; | |
if (doc.DocumentNode.SelectNodes("//img[@usemap]") != null) { | |
HtmlNode img = doc.DocumentNode.SelectSingleNode("//img[@usemap]"); | |
img.ParentNode.RemoveChild(img); | |
} | |
if (doc.DocumentNode.SelectNodes("//map") != null) { | |
HtmlNode map = doc.DocumentNode.SelectSingleNode("//map"); | |
map.ParentNode.RemoveChild(map); | |
} | |
var newHtml = doc.DocumentNode.InnerHtml; | |
<pre>@oldHtml</pre> | |
<hr /> | |
<pre>@newHtml</pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment