Over a million developers have joined DZone.

Part Of A Chump Parser / Viewer

·

require 'rubygems'
require 'rexml/document'
require 'markaby'
class Chump
  chump = REXML::Document.new(File.new( "chump.xml" ))
  mab = Markaby::Builder.new
  mab.html do
    head { title "The Daily Chump" }
    body do
      h1 "The Daily Chump"
      ul do
        chump.elements.each("churn/link") do |el|
          unless el.attributes['type'] == 'blurb'
            title = el.elements['title'] ? el.elements['title'].text : el.elements['url'].text
            link = a title, :href => el.elements['url'].text
            li link<< " - posted by "<< el.elements['nick'].text
          else
            li el.elements['title'].text if el.elements['title']
          end
           li "posted at "<< el.elements['time'].text
        end
      end
    end
  end
  puts mab.to_s
end
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}