The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
New, Little Hpricot Pulps

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
New, Little Hpricot Pulps Posted: Oct 25, 2006 10:50 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: New, Little Hpricot Pulps
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

Element#css_path

 doc.at("div > div:nth(1)").css_path
 #=> "div > div:nth(1)" 
 doc.at("#header").css_path
 #=> "#header" 

Element#xpath

 doc.at("div > div:nth(1)").xpath
 #=> "/div/div:eq(1)" 
 doc.at("#header").xpath
 #=> "//div[@id='header']" 

Element#swap

 doc = Hpricot("That's my <b>spoon</b>, Tyler.")
 doc.at("b").swap("<i>fork</i>")
 doc.to_html
 #=> "That's my <i>fork</i>, Tyler." 

Element#next_sibling, Element#previous_sibling

 (doc/:h3).each do |h3|
 while ele = h3.next_sibling
 ary << ele # stuff away all the elements under the h3
 end
 end

Raise a flag for pre-release gems, both source and win32:
gem install hpricot --source code.whytheluckystiff.net.

Read: New, Little Hpricot Pulps

Topic: Why OOP Alone in Java is Not Enough Previous Topic   Next Topic Topic: Java EE Libre en Hola Mundo

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use