style search

12 views
Skip to first unread message

Arlantir

unread,
Jun 6, 2017, 11:23:05 AM6/6/17
to nokogiri-talk
Hi,

How can I write a style, tried to do this, but the code does not work?

var = doc.css('div[@style='style']')
  puts
var.search "//h2/a"
end

Mike Dalessio

unread,
Jun 6, 2017, 4:29:20 PM6/6/17
to nokogiri-talk
Hi,

Thanks for asking this question.

Can you please show us the HTML you're parsing, and the desired result of your search? Then people may be able to provide more specific and useful advice.

Cheers,
-m

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-talk+unsubscribe@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Arlantir

unread,
Jun 7, 2017, 1:03:26 AM6/7/17
to nokogiri-talk
Hi,

At me in the document to become, they begin with the current and style:

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.5pt;padding:0cm 0cm 1.0pt 0cm'>

To understand where the beginning of the article I need to write a condition with style.

вторник, 6 июня 2017 г., 23:29:20 UTC+3 пользователь Mike Dalessio написал:
Hi,

Thanks for asking this question.

Can you please show us the HTML you're parsing, and the desired result of your search? Then people may be able to provide more specific and useful advice.

Cheers,
-m
On Tue, Jun 6, 2017 at 11:23 AM, Arlantir <arlan...@gmail.com> wrote:
Hi,

How can I write a style, tried to do this, but the code does not work?

var = doc.css('div[@style='style']')
  puts
var.search "//h2/a"
end

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.

Thomas Walpole

unread,
Jun 7, 2017, 4:26:33 PM6/7/17
to nokogiri-talk
CSS doesn't use @ to specify attribute selectors (XPath does).  You want

    
doc.css("div[style='style']")
Reply all
Reply to author
Forward
0 new messages