Parse and traverse HTML in your RubyMotion app. It's like Nokogiri for RubyMotion!

Motion::HTML uses IGHTMLQuery under the hood.

Currently, only iOS and OS X are supported.


Add this line to your application's Gemfile:

gem 'motion-html'

And then execute:

$ bundle && rake pod:install


Initialize a new document:

doc =
# or simply:
doc = Motion::HTML.parse(html)

Then query using css or xpath selectors. It returns an array of nodes:

nodes = doc.query('.photos li a')

Iterate over the results, and use the attributes or content:

nodes.each do |node|
  puts "Link text: " + node.text
  puts "Link URL: " + node['href']

So far, these are the only features that I have needed. Feel free to submit a GitHub issue if you need anything else.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request