{"id":3691,"date":"2012-09-03T18:36:01","date_gmt":"2012-09-03T00:36:01","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/3691"},"modified":"2012-09-03T18:42:18","modified_gmt":"2012-09-03T09:42:18","slug":"c-htmldom-%e3%81%ae%e5%ae%9f%e5%8a%9b%e3%82%92%e6%8e%a2%e3%82%8b-%e3%81%a4%e3%83%bc%e3%81%8b%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9%e3%81%8c%e6%82%aa%e3%81%84%e3%81%91","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/3691","title":{"rendered":"[C#] HtmlDom \u306e\u5b9f\u529b\u3092\u63a2\u308b&#8230;\u3064\u30fc\u304b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u60aa\u3044\u3051\u3069"},"content":{"rendered":"<p><a href=\"http:\/\/pp-club.net\/\">PP-Club<\/a> \u30e1\u30f3\u30d0\u306e\u7f8e\u5d0e\u3055\u3093\u306e\u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\u306e\u8a18\u4e8b<\/p>\n<p>SimpleStyle100\u56de\u7a81\u7834\u8a18\u5ff5\uff5e\u7de8\u96c6\u90e8\u304c\u9078\u3076\u7f8e\u5d0e\u85ab\u6c0f\u306e\u30a2\u30d7\u30ea25\u9078 : \u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\uff3b\u65e5\u672c\u7248\uff3d<br \/>\n<a href=\"http:\/\/www.lifehacker.jp\/2012\/05\/120417misakihacks.html\">http:\/\/www.lifehacker.jp\/2012\/05\/120417misakihacks.html<\/a><br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089\u5909\u6570\u3092\u51fa\u529b\u3059\u308b\u30d8\u30eb\u30d1\u30fc\u300emakeMessagebox\u300f\uff08SimpleStyle\u7b2c119\u56de\uff09 : \u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\uff3b\u65e5\u672c\u7248\uff3d<br \/>\n<a href=\"http:\/\/www.lifehacker.jp\/2012\/08\/12-08-30makemessageboxsimplestyle119_1.html\">http:\/\/www.lifehacker.jp\/2012\/08\/12-08-30makemessageboxsimplestyle119_1.html<\/a><\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_01org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_01thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3092\u306a\u3093\u3068\u304b\u6d3b\u7528\u3067\u304d\u306a\u3044\u304b\u3068\u3001\u7f8e\u5d0e\u3055\u3093\u5f53\u4eba\u306b\u76f8\u8ac7\u3057\u305f\u3068\u3053\u308d\u300c\u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\u306e\u76ee\u6b21\u3063\u3066\u7528\u610f\u3055\u308c\u3066\u3044\u306a\u3044\u3093\u3067\u3059\u3088\u306d\uff5e orz\u300d\u306e\u8fd4\u4e8b\u304c orz \u3042\u3042\u3001\u76ee\u6b21\u306a\u3044\u3093\u3067\u3059\u306d\u3001\u3053\u308c\u3002<\/p>\n<p>\u4e00\u5fdc\u3001\u5f53\u4eba\u7684\u306b\u306f\u3001<a href=\"http:\/\/www42.tok2.com\/home\/papermoon\/\">http:\/\/www42.tok2.com\/home\/papermoon\/<\/a> \u306a\u3068\u3053\u308d\u3067\u3001\u81ea\u52d5\u751f\u6210\u3092\u8a66\u307f\u3066\u3044\u308b\u3089\u3057\u3044\u306e\u3067\u3059\u304c\u3001\u3061\u3087\u3063\u3068\u3053\u308c\u3067\u306f\u30a2\u30ec\u3059\u304e\u3066\u5168\u4f53\u306e\u898b\u901a\u3057\u304c\u4ed8\u304d\u307e\u305b\u3093\u3002CSS \u3067\u9069\u5f53\u306b\u30ec\u30a4\u30a2\u30a6\u30c8\u3059\u308c\u3070\u3044\u3044\u3093\u3067\u3057\u3087\u3046\u304c\u3001\u81ea\u52d5\u751f\u6210\u306e\u7cbe\u5ea6\u304c\u60aa\u3044\u3089\u3057\u304f\u3068\u3044\u3046\u3068\u3053\u308d\u3060\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u3067\u3001\u672c\u683c\u7684\u306a\u3068\u3053\u308d\u306f\u30e9\u30a4\u30d5\u30e9\u30c3\u30ab\u30fc\u3078\u306e\u30af\u30ed\u30fc\u30ea\u30f3\u30b0\u304b\u3001google api \u3092\u4f7f\u3046\u306e\u304c\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u3072\u3068\u307e\u305a\u3001\u5148\u306e\u30da\u30fc\u30b8\u304b\u3089\u30ea\u30f3\u30af\u3068\u30bf\u30a4\u30c8\u30eb\u3050\u3089\u3044\u306f\u629c\u304d\u51fa\u3057\u3066 Excel \u3067\u6574\u7406\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u306f\u3084\u308a\u305f\u3044\u3068\u601d\u3046\u8a33\u3067\u3059\u3088\u3002\u306a\u306e\u3067\u3001\u624b\u9806\u3068\u3057\u3066\u306f\u3001<\/p>\n<ol>\n<li>\u8a72\u5f53\u3059\u308b\u30da\u30fc\u30b8\u3092 HTML \u30d5\u30a1\u30a4\u30eb\u3067\u300c\u624b\u52d5\u300d\u3067\u4fdd\u5b58\u3002<\/li>\n<li>HtmlDom \u3092\u4f7f\u3063\u3066\u3001\u30ea\u30f3\u30af\u3068\u30bf\u30a4\u30c8\u30eb\u3092\u62bd\u51fa\u3059\u308b\u3002<\/li>\n<li>CSV\u30d5\u30a1\u30a4\u30eb\u3078\u66f8\u304d\u51fa\u3057\u3002<\/li>\n<li>Excel \u3067\u958b\u3044\u3066\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u9069\u5f53\u306b\u6574\u5f62<\/li>\n<\/ol>\n<p>\u300c\u624b\u52d5\u300d\u306a\u3068\u3053\u308d\u304c\u6df7\u3058\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u5168\u4f53\u306e\u4f5c\u696d\u91cf\u3092\u8003\u3048\u308b\u3068\u306a\u306b\u3082\u5168\u4f53\u3092\u300c\u81ea\u52d5\u5316\u300d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u30c3!!! \u3063\u3066\u306e\u304c PP-Club \u306e\u4fe1\u6761\u3067\u3057\u3066\uff08\u3064\u30fc\u304b\u3001\u79c1\u81ea\u8eab\u306e\u4fe1\u6761\uff09\u3001\u30ea\u30f3\u30af\u3068\u30bf\u30a4\u30c8\u30eb\u3060\u3051\u3092\u53d6\u308a\u51fa\u305b\u3070\u3088\u3044\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u5143\u306e HTML \u30bd\u30fc\u30b9<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_02org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_02thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u62bd\u51fa\u5f8c\u306e\u30bd\u30fc\u30b9<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_03org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_03thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>Excel \u306b\u8cbc\u308a\u3064\u3051<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_04org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2012\/09\/wpid-dworkblogimage20120903_04thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3068\u3059\u308b\u8a33\u3067\u3059\u3002<br \/>\n\u5b9f\u306f\u5143\u306e HTML \u30bd\u30fc\u30b9\u306f\u3001<\/p>\n<ul>\n<li>\u30bf\u30a4\u30c8\u30eb\u304c\u91cd\u8907\u3057\u3066\u3044\u308b<\/li>\n<li>\u5225\u306e\u30ea\u30f3\u30af\u3082\u542b\u307e\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n<p>\u306a\u611f\u3058\u3067\u3001\u3061\u3087\u3063\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306b\u306f\u3084\u3084\u3053\u3057\u3044\u306e\u3067\u3059\u3002\u305d\u3046\u3001\u30c8\u30e9\u30a4\uff06\u30a8\u30e9\u30fc\u304c\u5fc5\u8981\u306a\u306e\u3067\u3059\u306d\u3002<br \/>\n&#8230;\u304c\u3001HtmlDom \u3092\u4f7f\u3046\u3068\u3001\u3053\u308c\u3050\u3089\u3044\u7c21\u5358\u306b\u66f8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nstatic void Main(string&#x5B;] args)\r\n{\r\n\tstring path = &amp;quot;\\\\temp\\\\simplestyle_idx.html&amp;quot;;\r\n\r\n\tvar doc = new HtmlDocument().Load(path);\r\n\t\/\/ A\u30bf\u30b0\u3067\u300cSimpleStyle \u7b2c??\u56de\u300d\u3092\u542b\u3080\u3082\u306e\u3092\u53d6\u5f97\r\n\tvar cont = new HtmlNavigator(doc)\r\n\t\t.Where(n =&gt; n.TagName == &amp;quot;a&amp;quot; &amp;&amp;\r\n\t\t\tn.Value.Contains(&amp;quot;SimpleStyle \u7b2c&amp;quot;))\r\n\t\t.Select(n =&gt; new { url = n % &amp;quot;href&amp;quot;, text = n.Value })\r\n\t\t.Distinct();\r\n\r\n\tforeach (var n in cont)\r\n\t{\r\n\t\tConsole.WriteLine(&amp;quot;{0}\\t{1}&amp;quot;,\r\n\t\t\tn.url, n.text);\r\n\t}\r\n}\r\n<\/pre>\n<p>\u307e\u3042\u3001\u3053\u308c\u3082\u4e00\u767a\u3067\u66f8\u3051\u305f\u308f\u3051\u3067\u306f\u306a\u304f\u3066\u4f55\u5ea6\u304b\u66f8\u304d\u76f4\u3057\u3066\u3044\u308b\u8a33\u3067\u3059\u304c\u3001\u3053\u308c\u3050\u3089\u3044\u77ed\u3044\u3068\u3061\u307e\u3061\u307e\u3068\u8a2d\u8a08\u3092\u66f8\u3044\u3066\u3044\u308b\u3088\u308a\u3082\u4f55\u304b\u3068\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u305f\u307b\u3046\u304c\u65e9\u3044\u8a33\u3067\u3059\u3002\u3048\u3048\u3001\u5f53\u7136\u300c\u8a2d\u8a08\u300d\u304c\u5fc5\u8981\u306a\u5834\u5408\u3082\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u306e\u8a71\u306f\u307e\u305f\u5225\u306e\u3068\u304d\u306b\u3002<\/p>\n<p>HtmlDom \u306f github \u3067<br \/>\n<a href=\"https:\/\/github.com\/moonmile\/XmlDom\">https:\/\/github.com\/moonmile\/XmlDom<\/a><\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\u306e SimpleStyle \u306e\u76ee\u6b21\u306f\u3082\u3046\u3061\u3087\u3063\u3068\u8003\u3048\u307e\u3059\u3002\u5143\u30bd\u30fc\u30b9\u81ea\u4f53\u304c\u3001\u7b2c87\u56de\u307e\u3067\u3057\u304b\u306a\u3044\u306e\u3067\u3061\u3087\u3063\u3068\u53e4\u3044\u306e\u3067\u3002\u4eca\u306f120\u56de\u4f4d\u3067\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u73fe\u72b6\u306e HtmlDom \u306f\u4f7f\u3044\u7269\u306b\u306a\u3089\u306a\u3044\u4f4d\u9045\u3044\u306e\u3067\u3001\u73fe\u5728\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8abf\u7bc0\u4e2d\u3067\u3059\u3002\u3069\u3046\u3084\u3089\u3001COM -&gt; .NET \u5909\u63db\u306e\u3068\u3053\u308d\u304c\u9045\u3059\u304e\u308b\u307f\u305f\u3044\u306a\u306e\u3067\u3001C++\/CLI \u3067\u66f8\u304d\u76f4\u305b\u3070\u3088\u3044\u304b\u3068\u6a21\u7d22\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PP-Club \u30e1\u30f3\u30d0\u306e\u7f8e\u5d0e\u3055\u3093\u306e\u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\u306e\u8a18\u4e8b SimpleStyle100\u56de\u7a81\u7834\u8a18\u5ff5\uff5e\u7de8\u96c6\u90e8\u304c\u9078\u3076\u7f8e\u5d0e\u85ab\u6c0f\u306e\u30a2\u30d7\u30ea25\u9078 : \u30e9\u30a4\u30d5\u30cf\u30c3\u30ab\u30fc\uff3b\u65e5\u672c\u7248\uff3d http:\/\/www.lifehacker.jp\/2012 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/3691\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[23,48,47],"tags":[],"class_list":["post-3691","post","type-post","status-publish","format-standard","hentry","category-csharp","category-pp-club","category-xmldom"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=3691"}],"version-history":[{"count":5,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3691\/revisions"}],"predecessor-version":[{"id":3693,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3691\/revisions\/3693"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=3691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=3691"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=3691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}