次のHTMLスニペットを前提として、属性がに等しいタグとmeta
属性がに等しいタグのコンテンツ属性のテキストを抽出する必要があります。Groovy:XMLSlurperの正しい構文で示されているものを試し、特定の属性を持つ要素を見つけましたが、 Groovy1.8.6では同じようには機能しないようです。name
description
meta
property
og:title
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta property="fb:admins" content="100003979125336" />
<meta name="description" content="Shiny embossed blue butterfly" />
<meta name="keywords" content="Fancy That Blue Butterfly Platter" />
<meta property="og:title" content="Fancy That Blue Butterfly Platter" />
GPathでこれらを取得するためのクリーンな方法はありますか?