Nokogiri:查找第一个没有class属性的节点发生

问题描述:

在下面的代码片段中,我想首先发现没有class属性的<b>标签。Nokogiri:查找第一个没有class属性的节点发生

<html> 
<body> 
    <p>This is the <b class="abc">text in bold with a class attribute</b> and the following is <b> text in bold without a class attribute</b> 
</body> 
</html> 

任何指针?

这将是:

doc.at('b:not([class])') 
+0

感谢。这工作。 – Surekha 2013-02-20 17:37:25

+0

@Surekha您应该将答案标记为已接受 – 2013-02-27 02:19:22