0
考虑下面的HTML片段,我需要提取的内容属性的文本为meta
标签与属性name
等于description
和meta
标签与属性property
等于og:title
。我试过Groovy: Correct Syntax for XMLSlurper to find elements with a given attribute上显示的内容,但它在Groovy 1.8.6中看起来并不一样。选择使用的XmlSlurper像WHERE子句
<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?
嗯,这让我空字符串1.8.6。我使用indexOf强制它,但我仍然想知道为什么这不起作用。 –